Поделиться через


Using the Entity Designer with ASP.NET

The ADO.NET Entity Data Model Designer (Entity Designer) and the Entity Data Model Wizard can be used with the following ASP.NET Visual Studio project types:

  • ASP.NET Web Application

  • ASP.NET Web Service

  • ASP.NET Web Site

ASP.NET Web Application and Web Service Projects

In ASP.NET Web Application and Web Service projects, the Entity Designer and the Entity Data Model Wizard function in almost the same way as they do in Class Library, Console Application, and Windows Application project types. The only difference is that the Entity Data Model Wizard stores the connection string information in a Web.Config file, instead of an App.Config file.

ASP.NET Web Site Project

If you are using the Entity Designer and the Entity Data Model Wizard in ASP.NET Web Site projects, you should be aware of the following differences from other project types.

  • In addition to adding references to the System.Data, System.Data.Entity, System.Core, System.Security, and System.Runtime.Serialization assemblies, the Entity Data Model Wizard also adds a reference to the System.Data.Entity.Design assembly. The System.Data.Entity.Design assembly contains EDM build providers for the ASP.NET build environment.

  • The .edmx file, which contains model information, is considered code and must be added to the App_Code folder (or a sub folder) of the ASP.NET Web Site project. If you decide to add the .edmx file to another directory, the model will not be processed by the EDM build provider for ASP.NET. For more information about how ASP.NET compiles projects, see ASP.NET Compilation Overview.

  • The Entity Data Model Wizard registers the EDM build provider in the Web.Config file.

ASP.NET Web Application Example

To build an example ASP.NET Web Application that uses an Entity Data Model, see Walkthrough: Creating the Course Manager Web Application

See Also

Other Resources

Entity Data Model Tools
ADO.NET Entity Data Model Designer Scenarios