AdventureWorks Complete Model (EDM)
エンティティ データ モデル (EDM) に基づくアプリケーションの多くは、スキーマと使用中のデータベースとのマッピングを必要とします。既存データへのマッピングは、概念デザインの完了後にストレージ モデルを実装するよりも複雑です。
SQL Server に付属している AdventureWorks データベースは、SQL Server の機能を説明するために設計されている、正規化された大規模なデータベースです。AdventureWorks データベースには 5 つのサブセクションがあり、これらのサブセクションはすべて、概念スキーマ定義言語 (CSDL) を使用した単一の EntityContainer で指定できます。ストレージ モデルは、ストア スキーマ定義言語 (SSDL) のメタデータで記述されます。概念スキーマとストレージ スキーマとのマッピングは、マッピング スキーマ言語 (MSL) を使用して行います。
以下のトピックのスキーマはすべて、コマンド ライン ツール EdmGen.exe によって生成されたものです。使用した単一のコマンドの構文には、/FullGeneration、/Project:AdventureWorks、/Provider のスイッチ、および AdventureWorks データベースへの接続文字列が含まれています。
C:\>%windir%\Microsoft.NET\Framework\v3.5\edmgen.exe /mode:fullgeneration /project:AdventureWorks
/provider:System.Data.SqlClient
/connectionstring:"server=.\sqlExpress;
integrated security=true;database=AdventureWorks" /outssdl:c:\BuildSchemas\AdventureWorks.ssdl /outcsdl:c:\BuildSchemas\AdventureWorks.csdl
/outmsl:c:\BuildSchemas\AdventureWorks.msl
/outViews:c:\BuildSchemas\AdventureWorks.Views.cs
/outObjectLayer:c:\BuildSchemas\AdventureWorks.ObjectLayer.cs
この非常に大きなデータベースのスキーマは、このツールによって適切に生成されました。CSDL スキーマは、AdventureWorks データベースの他のすべての機能のためのプログラム可能なオブジェクトを構築する際に使用される仕様です。出力を次に示します。
Microsoft (R) EdmGen version 3.5.0.0
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Loading database information...
warning 6002: The table/view 'AdventureWorks.HumanResources.vEmployee' does not
have a primary key defined. The key has been inferred and the definition was cre
ated as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.HumanResources.vEmployeeDepartment'
does not have a primary key defined. The key has been inferred and the definiti
on was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.HumanResources.vEmployeeDepartmentH
istory' does not have a primary key defined. The key has been inferred and the d
efinition was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.HumanResources.vJobCandidate' does
not have a primary key defined. The key has been inferred and the definition was
created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.HumanResources.vJobCandidateEducati
on' does not have a primary key defined. The key has been inferred and the defin
ition was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.HumanResources.vJobCandidateEmploym
ent' does not have a primary key defined. The key has been inferred and the defi
nition was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Person.vAdditionalContactInfo' does
not have a primary key defined. The key has been inferred and the definition wa
s created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Person.vStateProvinceCountryRegion'
does not have a primary key defined. The key has been inferred and the definiti
on was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Production.vProductAndDescription'
does not have a primary key defined. The key has been inferred and the definitio
n was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Production.vProductModelCatalogDesc
ription' does not have a primary key defined. The key has been inferred and the
definition was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Production.vProductModelInstruction
s' does not have a primary key defined. The key has been inferred and the defini
tion was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Purchasing.vVendor' does not have a
primary key defined. The key has been inferred and the definition was created a
s a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Sales.vIndividualCustomer' does not
have a primary key defined. The key has been inferred and the definition was cr
eated as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Sales.vIndividualDemographics' does
not have a primary key defined. The key has been inferred and the definition wa
s created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Sales.vSalesPerson' does not have a
primary key defined. The key has been inferred and the definition was created a
s a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Sales.vSalesPersonSalesByFiscalYear
s' does not have a primary key defined. The key has been inferred and the defini
tion was created as a read-only table/view.
warning 6002: The table/view 'AdventureWorks.Sales.vStoreWithDemographics' does
not have a primary key defined. The key has been inferred and the definition was
created as a read-only table/view.
Writing ssdl file...
Creating conceptual layer from storage layer...
Writing msl file...
Writing csdl file...
Writing object layer file...
Writing views file...
Generation Complete -- 0 errors, 17 warnings
このセクションの内容
AdventureWorks データのスキーマおよびマッピングについては、次の各トピックを参照してください。
- AdventureWorks の完全な概念スキーマ (EDM)
プログラミング オブジェクト モデルの構築に使用される概念スキーマについて説明します。
- AdventureWorks の完全なストレージ スキーマ (EDM)
オブジェクト モデルにマップするデータにアクセスできるようにするために使用されるストレージ メタデータについて説明します。
- AdventureWorks の完全なマッピング スキーマ (EDM)
概念モデルとストレージ メタデータの間のマッピングについて説明します。
- AdventureWorks オブジェクト モデルの使用 (EDM)
AdventureWorks モデル オブジェクトのエンティティおよびアソシエーションへのアクセスに使用されるコード シナリオについて説明します。
参照
その他のリソース
EDM 仕様
スキーマおよびマッピング スキーマ (Entity Framework)
スキーマおよびマッピング スキーマ (Entity Framework)