Entity Data Model (EDM) In Entity Framework
In the last post about entity framework I wrote an introduction about the framework.
Today I’m going to dive into the heart of the framework – the entity data model (EDM).
What is the Entity Data Model (EDM)?
The EDM is a specification for defining the data used by applications built on the
Entity data model (EDM) desgin:
There are three layers in the EDM:
- Conceptual layer
- Mapping layer
- Logical layer
The layers help to bridge the gap between the relational database schema and
the wanted entities in the application.
Every layer is represented in a XML schema.
The conceptual layer is defined by a Conceptual Schema Definition Language
(CSDL). The CSDL defines the entities and the relations between the entities
as expected from the business logic of the application.
The mapping layer is defined by a Mapping Schema Language (MSL).
The MSL defines the mapping between the conceptual layer and the logical layer.
The logical layer is defined by a Store Schema Definition Language (SSDL).
The SSDL is a representation of the relational database or part of it.
Lets generate a one to one mapping between a database and a business logic
From the Add New Item menu, choose the ADO.NET Entity Data Model and
add it to your project:
The result of choosing to add the EDM is a wizard that help you to build the EDM.
First, choose the model content. It can be generated from a database or from an
Then, choose your data connection in the same way you choose data connections
(by using a connection string or generating a new one):
A screen with the database tables, views and stored procedures will be open.
You can either choose everything or choose the relevant objects for the module
In a one to one mapping you will choose everything and therefore click the
Finish button to generate the EDM file in the project.
You can use the model browser view to look at the generated entities, tables and
In the next post I’m going to demonstrate the XML files types and how they are