How to: Generate Entity Data Models from an Existing Database Project

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Starting with Visual Studio 11 Developer Preview, the Entity Data Model Wizard allows you to create a model from an existing database project.

For information on how to create a database project, see How to: Create a New Database Project

To generate entity data models from an existing database project

  1. In Solution Explorer, add a new C# Windows Console Application to your solution by right-clicking the solution, select Add and New Project.

  2. Select Visual C#, Console Application and click OK.

  3. Right-click your new Windows Console Application in Solution Explorer and select Add, then New Item.

  4. Select ADO.NET Entity Data Model. Rename the new model to and click the Add button.

  5. The Entity Data Model Wizard launches. In the Choose Model Contents page, there are four options: Database model, Database project, Generate from database, and Empty model.

    In Visual Studio 11 Developer Preview, the Database model functionality is supported as a read-only data source.

    Select Database project. This will create an entity model that can be kept in sync with a specific database project. Click Next.

  6. In the Which database project should be used page, select the database project that you want to associate with your model. Click Next.

    You can now select the database objects to be included in your model.

  7. Click the checkbox next to the Tables node. Expand the Tables and dbo node and verify that all the tables are selected.

  8. Click Finish to generate the model.

  9. The ADO.NET Entity Data Model Designer opens, which allows you to visually create and modify entities, associations, mappings, and inheritance relationships.

    Notice that in Solution Explorer, a reference to the selected database project has been added.

See Also