共用方式為


Entity Data Model Wizard

The Entity Data Model Wizard is used to generate an Entity Data Model (EDM). The Entity Data Model Wizard allows you to create a model from an existing database (this is the recommended practice for this release of the ADO.NET Entity Data Model Designer), 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 to your project and it launches the ADO.NET Entity Data Model Designer (Entity Designer) after it finishes generating an EDM. For detailed information about how to add a model to your project, see the Generating the Entity Data Model Files section of How to: Create a New Entity Data Model.

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

  1. Choose Model Contents

    We recommend that you generate the model 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 EDM.

    Generating an empty model requires manually selecting a data source, database, and database objects after the Entity Data Model Wizard closes.

  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.

    Note

    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 EDM.

    Note

    If you include stored procedures in the EDM, 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.

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

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

Note

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 are now stored in the bin\Debug directory or the bin\Release directory of the solution. However, these files are not intended to be edited. Any modifications to the EDM 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 Overview

Other Resources

Entity Data Model Tools
Schemas and Mapping Specification (Entity Framework)