I have followed the instructions on section 3.4.3 in the developer manual and created a derived collection for my "Customer" domain object.
When I run the app and navigate to Customers->All Instances, an exception is thrown - the same self-explanatory one I've been dealing with before:
System.Data.Entity.DynamicProxies.Customer_D3528800DEA3C449DFB2B1B953541BB765397CEE0E37766722C4D87D214AB41B is not a IEntityWithChangeTracker (all properties must be made virtual/Overrideable and all collection properties should be of type ICollection<T>)
The example in the manual indeed doesn't include the virtual prefix, but even after I added it, I got the same exception.
The derived collection code is:
public virtual ICollection<ContentFolder> RootContentFolders
return _contentFolders.Where(cf => cf.Parent == null).ToList();
ContentFolder is a domain object and _contentFolders is the collection defined and used within the customer entity.
What am I missing?
p.s. My motivation for creating this derived collection is that I want to see only the root content folders in the Customer view.
All content folders are associated with a customer, and are also structured hierarchically, based on their Parent property (which is null in the case of a root folder).
I can probably find a recursive solution in which the customer is only associated with root folders, but I'm not sure that's what I want to do...