Sdílet prostřednictvím


Entity Data Model Wizard

The Entity Data Model Wizard is used to generate an .edmx file. For more information, see .edmx File Overview (Entity Framework). The Entity Data Model Wizard allows you to create a model from an existing database, or to generate an empty model. To watch a video that demonstrates how to use the wizard to generate a model from an existing database, see How Do I Get Started with the EDM Wizard ?.

The Entity Data Model Wizard starts after you add an ADO.NET Entity Data Model, item template to your project. The Entity Data Model Wizard then launches the ADO.NET Entity Data Model Designer (Entity Designer) after it finishes generating an .edmx file. For more information, see How to: Create a New .edmx File (Entity Data Model Tools).

The Entity Data Model Wizard guides you through the following steps:

  1. Choose Model Contents

    By selecting Generate from database, you can generate an .edmx file from an existing database. In the next steps, the Entity Data Model Wizard will guide you through selecting a data source, database, and database objects to include in the conceptual model.

    By selecting Empty model, you can add an .edmx file that contains empty conceptual model, storage model, and mapping sections to your project. Select this option if you plan to use the Entity Designer to build your conceptual model and later generate a database that supports the model. For more information, see How to: Generate a Database from a Conceptual Model (Entity Data Model Tools).

  2. Choose Your Data Connection

    You can select an existing connection from the drop-down list of connections, or click New Database Connection to open the Connection Properties dialog box and create a new database connection.

    NoteNote

    Visual Studio Express Editions cannot connect to a server. They can only connect to a file instance of a database.

  3. Choose Your Database Objects

    You can select tables, views, and stored procedures to include in the .edmx file.

    NoteNote

    If you include stored procedures, the Entity Data Model Wizard creates entries in the storage model for the stored procedures. You must manually add function import entries to the conceptual model. For more information, see How to: Import a Stored Procedure (Entity Data Model Tools).

    Beginning with Visual Studio 2010, the Choose Your Database Objects dialog box also allows you to perform the following customizations:

Upon closing, the Entity Data Model Wizard creates an .edmx file that contains the model information. The .edmx file is used by the Entity Designer, which enables you to view and edit the conceptual model and mappings graphically.

The Entity Data Model Wizard also creates a source code file that contains the classes that are generated from the CSDL content of the .edmx file. The source code file is automatically generated and is updated when the .edmx file changes.

NoteNote

Earlier versions of the Entity Data Model Wizard referred to .csdl, .ssdl, and .msl files. The information in these files is now encapsulated in the .edmx file. The .csdl, .ssdl, and .msl files can be embedded in an output assembly (the default) or copied to the output directory. (For more information, see How to: Copy Model and Mapping Files to the Output Directory (Entity Data Model Tools).) The .csdl, .ssdl, and .msl files are not intended to be edited. Any modifications to the conceptual model, storage model, or mappings should be made to the .edmx file by using the ADO.NET Entity Data Model Designer or the XML Editor.

In This Section

See Also

Concepts

ADO.NET Entity Data Model Designer

Other Resources

ADO.NET Entity Data Model Tools
CSDL, SSDL, and MSL Specifications