CSDL, SSDL, and MSL files for Entity Framework

ado.net-entity-data-model c# c#-4.0 entity-framework visual-studio-2010


I know I'm being fussy, but in researching how Entity Framework creates a DLL from an EDMX file, I came across the following on MSDN:

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.

The statement that the.csdl,.ssdl, and.msl are produced "at build time" genuinely struck me as odd, so I decided to test it. Knowing that the TablePerTypeStrategy.xaml flow is what creates the files, I uninstalled it and attempted to develop my own application. It was a hit.

I did get a missing TablePerTypeStrategy.xaml problem when I selected "create database from model." I became perplexed since it is obvious from this test that I am trying to produce the database, not develop the application, when I attempt to do so.

What do I not see here?

5/11/2012 9:50:37 PM

Accepted Answer

For usage by the Entity Framework classes at runtime, those files (.csdl,.ssdl, and.msl) are produced at build time and inserted as resources within the assembly. A alternative procedure that produces a database construction script is creating a database from a model.

5/11/2012 2:21:07 PM

Popular Answer

Build your project once first if you want to view *.csdl, *.ssdl, and *.msl files. After choosing your project (which contains the edmx files), as seen in the screenshot below, click on the "Show All Files" option in the solution explorer (indicated with a red arrow).

enter image description here

As shown by the directory structure,obj\x86\Debug\edmxResourcesToEmbed As can be seen in, all of the entity framework-specific xml files are generated during constructionobj and are incorporated as resources in a folder.

In my project, there were two edmx files, namelyEFCoding.edmx and Model1.edmx As a result, each file type is represented by two sets. I hope this viewpoint becomes useful to someone.

Note: By just changing a property for EF model designer as proposed by here, all of these EF meta information files may also be quickly moved to the project output directory (instead of being embedded).

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow