The DevForce code generator creates a model-specific subclass of the DevForce EntityManager that is specific to the application's entity model and therefore easier to work with. You'll find it at the top of the generated class file.
It might look something like this
C# | /// <summary> /// The domain-specific EntityManager for your domain model. /// </summary> public partial class NorthwindManager : IbEm.EntityManager { ... |
VB | ''' <summary> ''' The domain-specific EntityManager for your domain model. ''' </summary> Partial Public Class NorthwindManager Inherits IbEm.EntityManager ... |
The EntityManager is the most important component in all of DevForce and you will get to know it well. It is the portal to the server, the vehicle for queries and saves, and manages the container of entities (the entity cache) that reside in application memory.
It is not part of the model. It is machinery that uses the model but it is not of the model itself.
You really don’t need a custom subclass of the EntityManager - not the way you need the entity classes. You can do without it. You can use the base EntityManager class for everything … and sometimes that’s exactly what you’ll want to do.
DevForce generates one anyway because it is often more convenient to work with a custom EntityManager that is enriched with dedicated model properties than to use the base EntityManager.
The collection of custom IdeaBlade.EntityModel.EntityQuery<T> properties is a case in point. You can write a query to retrieve all Customers using an instance of any EntityManager like this:
C# | query = manager.GetQuery<Customer>(); // a Customer query for any EntityManager |
VB | query = manager.GetQuery(Of Customer)() ' a Customer query for any EntityManager |
The same query is easier to read and write when we use an instance of NorthwindManager, the custom EntityManager tailored to this specific model:
C# | query = manager.Customers; // the Customer query predefined for this model |
VB | query = manager.Customers ' the Customer query predefined for this model |
Finally, notice that NorthwindManager is a partial class that you can extend to suit your needs.