When you add a new item “ADO.NET Entity Data Model“, VS2010 adds 2 files into your project: “.edmx” and “.Designer.cs“. The “edmx” file is an XML file, which contains the storage schema, the conceptual schema, and the mapping between them. The “Designer.cs” has the partial Entity classes you are going to work with. The main focus of this post is the edmx file.
1. EDMX File
The “EDM” stands for the “Entity Data Model“. At design time, all information is packaged into a single edmx file. The build process splits the edmx file into three separate files:
- Storage Model
- Conceptual Model
2. Inspecting the XML File
The edmx file is composed of two main sections: “Runtime” and “Designer“.
The runtime section comprises three sections:
<edmx:Edmx> <edmx:Runtime> <edmx:StorageModels /> <edmx:ConceptualModels /> <edmx:Mappings /> </edmx:Runtime> <Designer /> </edmx:Edmx>
3. CSDL (Conceptual Schema Definition Language)
- EntityContainer: a wrapper for all entities and associations, an entry point to the model
- EntityType: a data type for a logical table (model class), which includes a set of properties
- Association: the relationship between entity types; endpoints and their multiplicity (navigation information)
4. SSDL (Store Schema Definition Language)
The elements of SSDL is similar to those of CSDL.
- EntityContainer: a wrapper for all entities and associations
- EntityType: a table or a view, the properties represents columns
- Association: the relationship between entity types; primary key/foreign key relationship
5. MSL (Mapping Specification Language)
You can view the mappings in the Designer’s “Mapping Details” Window. (Right click on any entity-> Table Mapping)
The mapping is usually straight forward; one-to-one mapping between the conceptual property and the database column.