Up Entity Data Model
DevForce Resource Center » Core concepts » Architecture » Entities » Entity Data Model » Entity Data Model XML (EDMX)

Entity Data Model XML (EDMX)

Last modified on August 15, 2012 17:33

The Entity Framework relies on an XML representation of the EDM (EDMX) with three layers.

edmx.gif
 
The top CSDL layer defines the entities, the bottom SSDL layer defines the database schema, and the middle MSL mapping layer aligns the CSDL and SSDL. The three layers can be exported as three free-standing XML files with file extensions .csdl, .msl, and .ssdl. 

Most developers won’t see these files; they’ll work with the composite EDMX file which has four sections as seen here:

ssdl.gif
 

SSDL – Storage Schema Definition
Describes the database schema (tables and columns).
CSDL – Conceptual Schema Definition 
Describes entities (types and properties).
C-S – Conceptual-Storage Mapping 
The MSL that maps conceptual entities to storage objects.
Designer – ignore it 
Records layout of entity graphics on the designer canvas.

The storage schema defines a Storage Model that describes the database layout. The storage model XML language is database-neutral ; it could describe a Microsoft SQL Server schema … or MySQL schema or Oracle schema. The Entity Framework is open to many database products – any database product for which there is an EF Data Provider. Most popular relational database products have an EF Data Provider. Of course EF provides its own SQL Server Data Provider out-of-the-box; you can search the web for other providers for other databases.

The conceptual entity schema defines a Conceptual Model that describes entity types and their properties. The conceptual model XML language is implementation-neutral. It doesn’t prescribe a particular representation. Anyone can read the conceptual schema and interpret it as they see fit. 

The typical Conceptual Model interpreter is a tool that generates .NET entity classes. The Entity Framework ships with a primary code generator that runs automatically every time you save changes to the EDM. You can replace that default generator with your own code generator … and DevForce does just that.

Although you can edit the EDMX with a text editor that is far from ideal. Most developers turn to the graphical editor in Visual Studio called the EDM Designer.

Tags:
Created by DevForce on February 25, 2011 13:58

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade