Reputation: 36126
I'm just being picky but I was researching how does Entity Framework generates the DLL from an EDMX file and I saw this 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.
I actually found strange it saying that "at build time" the .csdl, .ssdl, and .msl are created so I decided to test. I know that the files are generated based on the TablePerTypeStrategy.xaml flow, so I removed it and tried to build my the application. It succeeded.
When I picked "generate database from model" I did get an error saying the TablePerTypeStrategy.xaml file was missing. So I got confused, clearly from this test the generation is being made when I try to generate the database, not build the application.
What am I missing here?
Upvotes: 17
Views: 28643
Reputation: 25877
If you are interested in seeing CSDL, SSDL and MSL files then build your project once which contains the EDMX files. Now, click on Show All Files button (pointed by red arrow in the screenshot) after clicking your project node in the solution explorer.
The directory structure says it as obj\x86\Debug\edmxResourcesToEmbed. All the Entity Framework (EF) specific xml files are created during build as they can be seen in obj folder and are embedded as resource.
I had two EDMX files in my project namely EFCoding.edmx
and Model1.edmx
. So you can see two sets of each file type e.g. there are two *.csdl files. Hope this view helps someone.
Note: All these EF meta information files can also be copied to project output directory (in place of embedding them) by tweaking a property for EF model designer as suggested here.
Upvotes: 20
Reputation: 34810
Those files (.csdl, .ssdl, .msl) are generated at build time, and embedded as resources, into the assembly for use by the Entity Framework classes at runtime. Generating a database from a model is a different process that generates a database creation script.
Upvotes: 12