共用方式為


AdventureWorks Complete Model (EDM)

Many applications that are based on the Entity Data Model (EDM) require mapping schemas to a database that is already in use. Mapping to existing data is more complex than implementing the storage model after the conceptual design is finished.

The AdventureWorks database that is included with SQL Server is a large, normalized database designed to demonstrate the features of SQL Server. There are five subsections of the AdventureWorks database, all of which can be specified in a single EntityContainer using conceptual schema definition language (CSDL). The storage model is described by metadata in store schema definition language (SSDL). Mapping between conceptual and storage schemas is done in mapping specification language (MSL).

Note

New data types introduced in SQL Server 2008 are not supported explicitly by this version of the Entity Framework. These data types include the following: hierarchyid, geography, and filestream. Because the AdventureWorks 2008 database features these new data types, errors occur when generating a data model that is based on the AdventureWorks 2008 database. For more information, see the Microsoft SQL Server Product Samples: Database page on the CodePlex Web site.

All the schemas in the following topics were generated by the command line tool EdmGen.exe. The syntax of the single command used includes the /FullGeneration and /Project:AdventureWorks, /Provider switches, and a connection string to the AdventureWorks database.

"%windir%\Microsoft.NET\Framework\v3.5\edmgen.exe" /mode:fullgeneration /project:AdventureWorks  
/provider:System.Data.SqlClient /connectionstring:"server=localhost; integrated security=true;
database=AdventureWorks" /outssdl:AdventureWorks.ssdl /outcsdl:AdventureWorks.csdl 
/outmsl:AdventureWorks.msl /outViews:AdventureWorks.Views.cs /outObjectLayer:AdventureWorks.ObjectLayer.cs

Note

For 64-bit systems, EdmGen.exe is located in C:\windows\Microsoft.NET\Framework64\v3.5.

In this section

The following topics contain the schemas and mappings for the AdventureWorks data.

See Also

Other Resources

EDM Specifications
Schemas and Mapping Specification (Entity Framework)