Are you loading all the columns when you do Query.Load()? For example, do you have any calls to Query.AddResultColumn()?
- Code: Select all
// Using a Northwind example
Employees emp = new Employees();
// SELECT columns
// WHERE clause
emp.Where.EmployeeID.Value = 1;
// Generates SELECT [EmployeeID], [FirstName], [LastName] FROM [dbo].[Employees]
// Generates an exception because [City] was not in the SELECT clause
emp.s_City = \"Dayton\";
EasyObjects does not do any comparison of the SELECT clause and the Schema of the object. It basically just takes the results of the query and loads them into the object. In fact, you can load the object using any SELECT query, including from a different source table than the object was generated from!
But if you don't do \"SELECT *\" from the original table, you can't set all the column values using the generated properties, and you can't do a Save(), because the object is expecting all of the original table columns to be present in the object.
It's been a long-standing enhancement request to do dynamic saves (i.e. only the columns and values that have changed), but I don't have a delivery date for that feature.