David.Parsons:With this in the Northwind Employees custom collection class:
Code:
public void AddNotesColumn()
{
if (this.Table != null &&
this.Table.Columns.Contains("Notes") == false)
{
this.Table.Columns.Add("Notes", typeof(System.String));
}
}
Usage:
Code:
EmployeesCollection collection = new EmployeesCollection();
collection.Query.Select(
collection.Query.EmployeeID,
collection.Query.LastName,
collection.Query.FirstName);
collection.Query.Load();
collection.AddNotesColumn();
Employees emp = collection.AddNew();
emp.LastName = "Test";
emp.FirstName = "Test1";
emp.Notes = "Some notes.";
collection.Save();
Sweet, this is just what I need, thanks David.
One question; when I implemented the above I found that my Table property was null. The entity in question is part of a collection, so I then tried this.Row.Table and found a valid Table reference. Is this to be expected when working with an entity that is part of a collection?
If so, why not have a reference to the Table anyways? In other words, why not have this.Table -> this.Row.Table? It would make my code simpler as the method in question deals with entities that may or may not be in a collection so I need to check for Table == null or Row.Table == null.
Either way, I'm up and running and that's great! Thanks again,
Steve