How to: Use EdmGen.exe to Generate the Model and Mapping Files
This topic shows how to use the EDM Generator (EdmGen.exe) tool to generate the following files based on the School database:
A conceptual model (a .csdl file).
A storage model (a .ssdl file).
Mapping between the conceptual and storage models (a .msl file).
Object-layer code in Visual Basic or C#.
View files.
The EdmGen.exe tool uses /mode:FullGeneration to generate the files listed above. For more information about EdmGen.exe commands, see EDM Generator (EdmGen.exe).
If you use EdmGen.exe to generate the model and mapping files, you still need to configure your Visual Studio project to use the Entity Framework. For more information, see How to: Manually Configure an Entity Framework Project.
Note
A conceptual model generated by EdmGen.exe includes all the objects in the database. If you want to generate a conceptual model that includes only specific objects, use the Entity Data Model Wizard. For more information, see How to: Use the Entity Data Model Wizard.
To generate the School model for a Visual Basic project using EdmGen.exe
Create the School database. For more information, see Creating the School Sample Database.
At the command prompt, execute the following command without line breaks:
"%windir%\Microsoft.NET\Framework\v4.0.30319\edmgen.exe" /mode:fullgeneration /c:"Data Source=%datasourceserver%; Initial Catalog=School; Integrated Security=SSPI" /project:School /entitycontainer:SchoolEntities /namespace:SchoolModel /language:VB
To generate the School model for a C# project using EdmGen.exe
Create the School database. For more information, see Creating the School Sample Database.
At the command prompt, execute the following command without line breaks:
"%windir%\Microsoft.NET\Framework\v4.0.30319\edmgen.exe" /mode:fullgeneration /c:"Data Source=%datasourceserver%; Initial Catalog=School; Integrated Security=SSPI" /project:School /entitycontainer:SchoolEntities /namespace:SchoolModel /language:CSharp
See Also
Tasks
How to: Manually Configure an Entity Framework Project
How to: Pre-Generate Views to Improve Query Performance
How to: Use EdmGen.exe to Validate Model and Mapping Files
Other Resources
Modeling and Mapping
Entity Data Model Tools
Build Date:
2015-07-20