How to: Use EdmGen.exe to Generate an Entity Data Model (Entity Framework)

This topic shows how to use the EDM Generator (EdmGen.exe) tool to generate an Entity Data Model (EDM) based on the School database. If you use EdmGen.exe to generate an EDM, you will still have to configure your Visual Studio project to use the Entity Framework. For more information, see How to: Manually Configure an Entity Framework Project.

Note

An EDM generated by EdmGen.exe includes all the objects in the database. If you want to generate an EDM that includes only specific objects, use the Entity Data Model Wizard. For more information, see How to: Use the Entity Data Model Wizard (Entity Framework).

To generate the School model for a Visual Basic project using EdmGen.exe

  1. Create the School database. For more information, see Creating the School Sample Database (Entity Framework Quickstart).

  2. At the command prompt, execute the following command without line breaks:

    "%windir%\Microsoft.NET\Framework\v3.5\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

  1. Create the School database. For more information, see Creating the School Sample Database (Entity Framework Quickstart).

  2. At the command prompt, execute the following command without line breaks:

    "%windir%\Microsoft.NET\Framework\v3.5\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 (Entity Framework)
How to: Use EdmGen.exe to Validate an Entity Data Model

Other Resources

Defining an Entity Data Model (Entity Framework Tasks)
Entity Data Model Tools