Entity Framework Entities w/ EDMX
This topic introduces important high-level concepts you need to know in order to use MM .NET with the Entity Framework and an EDMX file effectively.
Note:If you're building a new Entity Framework project, we highly recommend NOT using an EDMX file since it is no longer supported by Microsoft. Check out the Help topic Entity Framework Core vs. Entity Framework 6 instead.
The Entity Data Model
The Entity Data Model (EDM) is a diagram in which you can visually design your entity objects. For example:
When you rebuild your project, Visual Studio generates an entity class for each entity shape in your Entity Data Model. You can either manually create entities in the diagram or (more commonly) you can automatically generate entity objects from your application's database using the Entity Data Model Wizard.
Note: The Entity Data Model only generates one portion of your business object--the entity object. It doesn't generate the main controller class or business rules class. You should still use the MM .NET Business Layer Generator to create these.
When using the Entity Framework, you do not access the back end database directly. Instead, all queries are executed against the Entity Data Model (EDM) that is part of your project. The Entity Framework converts your queries to the appropriate back end database syntax.

The Object Context
In addition to the entities that are generated from the Entity Data Model, Visual Studio also generates a single Object Context class. This is the main class you use to interact with the Entity Data Model to perform queries that retrieve entities from the back end.
The Object Context class doesn't appear on the Entity Data Model, but you can see it in this class diagram:

Notice there is an "Entity Set" property on the Object Context for each entity in the diagram. These entity sets are what you create queries against in your business object code. You can return a single entity or a list of entities. For example:
public EmployeeEntity GetEmployeeByID(int employeeID)
{
IQueryable<EmployeeEntity> query = from e in this.ObjectContext.EmployeeEntitySet
where e.EmployeeID == employeeID
select e;
return this.GetEntity(query);
}
When generating business objects with the MM .NET Business Layer Generator's Entity Framework checkbox selected, the BLG adds an ObjectContext property to the main business object controller class. This provides easy access to the Object Context for creating queries. Other than that, you don't need to access the Object Context directly because MM .NET wraps up its functionality in a standard data access class (for example, mmDataAccessSqlEF). When you call business object methods such as SaveEntity(), DeleteEntity(), and CancelEntity(), behind the scenes, MM .NET issues the corresponding commands to the Object Context for you.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 02/11/26
Comment or report problem with topic
