Modello completo di AdventureWorks (EDM)
Numerose applicazioni basate su Entity Data Model (EDM) richiedono il mapping degli schemi a un database già in uso. L'esecuzione del mapping ai dati esistenti è più complessa rispetto all'implementazione del modello di archiviazione dopo il completamento della progettazione concettuale.
Il database AdventureWorks incluso in SQL Server è un database normalizzato di grandi dimensioni progettato per illustrare le funzionalità di SQL Server. Nel database sono presenti cinque sottosezioni, che possono essere specificate tutte in un singolo oggetto EntityContainer utilizzando CSDL (Conceptual Schema Definition Language). Il modello di archiviazione è descritto dai metadati in SSDL (Store Schema Definition Language). Il mapping tra lo schema concettuale e quello di archiviazione viene eseguito in MSL (Mapping Specification Language).
Tutti gli schemi negli argomenti seguenti sono stati generati dallo strumento da riga di comando EdmGen.exe. La sintassi del singolo comando utilizzato include le opzioni /FullGeneration e /Project:AdventureWorks, /Provider e una stringa di connessione al database 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
Gli schemi per questo database di dimensioni molto estese sono stati generati correttamente dallo strumento. Lo schema CSDL è la specifica utilizzata per compilare gli oggetti programmabili per tutte le altre funzionalità del database AdventureWorks. Di seguito viene riportato l'output.
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
Contenuto della sezione
Negli argomenti seguenti sono inclusi gli schemi e i mapping per i dati di AdventureWorks.
- Schema concettuale completo di AdventureWorks (EDM)
Viene descritto lo schema concettuale utilizzato per compilare il modello a oggetti di programmazione.
- Schema di archiviazione completo di AdventureWorks (EDM)
Vengono descritti i metadati di archiviazione utilizzati per rendere accessibili i dati in modo da poterli mappare al modello a oggetti.
- Schema di mapping completo di AdventureWorks (EDM)
Viene descritto il mapping tra il modello concettuale e i metadati di archiviazione.
- Utilizzo del modello a oggetti di AdventureWorks (EDM)
Vengono descritti scenari di codice utilizzati per accedere alle entità e alle associazioni nel modello a oggetti di AdventureWorks.
Vedere anche
Altre risorse
Specifiche EDM
Specifica di schemi e mapping (Entity Framework)
Specifica di schemi e mapping (Entity Framework)