This article is part two of a four part series on the ADO.NET Entity Framework. In this artilce we will now take a look at how to create a data model using the Entity Data Model generation tool called EdmGen. The EdmGen.exe command line tool can be used to do one or more of the following:
- Generate the .cdsl, .msl, and .ssdl files as part of the Entity Data Model
- Generate object classes from a .csdl file
- Validate an Entity Data Model
The EdmGen.exe command line tool generates the Entity Data Model as a set of three files: .csdl, .msl, and .ssdl. If you have used the ADO.NET Entity Data Model Designer to generate your Entity Data Model, the .edmx file generated will contain the CSDL, MSL, and the SSDL sections. You will have a single .edmx file that bundles all of these sections into it. On the other hand, if you use the EdmGen.exe tool to generate the Entity Data Model, you would find three distinctly separate files with .csdl, .msl or .ssdl extensions.
Here is a list of the major options of the EdmGen.exe command line tool: Note that you basically need to pass the connection string, specify the mode, and also the project name of the artifact files (.csdl, .msl, and the .ssdl files) to be created. To create the Entity Data Model for our database, open a command window and type in the following: edmgen /mode:fullgeneration /c:”Data Source=.;Initial Catalog=Payroll;User ID=sa;Password=joydip1@3;” /p:Payroll This will create a full ADO.NET Entity Data Model for our database. The output is shown in the following figure: