Tuesday, October 5, 2010

ADO.NET Entity Framework TIPS -What is CSDL, SSDL, MSL, EDMX Files

What are CSDL, SSDL, and MSL Files

CSDL - Conceptual schema definition language.
SSDL - Store schema definition language
MSL - Mapping specification language
are XML-based languages that respectively describe the conceptual model, storage model, and the mapping between these models. In an Entity Framework application, model and mapping metadata are loaded from three files with extensions .csdl, .ssdl, and .msl. The metadata contained in the .csdl and .ssdl files is loaded into instances of the System.Data.Metadata.Edm.EdmItemCollection and System.Data.Metadata.Edm.StoreItemCollection classes, which are accessible by using methods in the System.Data.Metadata.Edm.MetadataWorkspace class. Mapping information is not publicly accessible. The Entity Framework uses the metadata in these types to translate queries against the conceptual model to data source-specific commands.

When are they generated?

The Entity Data Model Designer (Entity Designer) stores model and mapping information in an .edmx file at design time. At build time the Entity Designer uses the information in an .edmx file to create the .csdl, .ssdl, and .msl files that are needed by the Entity Framework at runtime

Where are they located?

By default, they included in the binary file of output under bin folder. You are not able see the physical files.
But you can also output CSDL, SSDL, and MSL Files as saparated files to bin folder. Here is how to make this happen.

After change Meta Artifact Processing to "Copy to Output Directory", rebuild your project and you will see the CSDL, SSDL, and MSL Files are generated under bin.

Related Links
What is ASO.NET Entity Framework 4.0

1 comment:

leolido said...

It is a very clear and useful tips.