Elemento Schema (CSDL)
L'elemento Schema è l'elemento radice di uno schema concettuale in Entity Data Model (EDM). L'elemento Schema è la specifica per l'oggetto Namespace che contiene le entità e le associazioni utilizzate dal modello a oggetti definito. Lo schema concettuale è definito in CSDL (Conceptual Schema Definition Language). Gli elementi EntityType e Association nello schema concettuale sono elementi figlio dell'elemento Schema.
L'elemento EntityContainer è la specifica per una classe nel modello a oggetti progettato. EntitySet e AssociationSet sono elementi figlio di EntityContainer.
Per informazioni sugli elementi EntityType e Association, vedere gli argomenti correlati in questa sezione. Per ulteriori informazioni sull'elemento EntityContainer, vedere Elemento EntityContainer (CSDL).
Nella dichiarazione di schema seguente vengono illustrati l'elemento Schema e i relativi elementi figlio.
<Schema Namespace="AdventureWorksHRModel" Alias="Self"
xmlns="https://schemas.microsoft.com/ado/2006/04/edm">
<EntityType Name="Department"
<Key>
<PropertyRef Name="DepartmentID" />
</Key>
<Property Name="DepartmentID" Type="Int16" Nullable="false" />
<Property Name="Name" Type="String" Nullable="false" />
<Property Name="GroupName" Type="String" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
</EntityType>
<EntityType Name="Employee"
<Key>
<PropertyRef Name=EmployeeID>
</Key>
<Property Name="EmployeeID" Type="Int32" Nullable="false" />
<Property Name="NationalIDNumber" Type="String" Nullable="false" />
<Property Name="ContactID" Type="Int32" Nullable="false" />
<Property Name="LoginID" Type="String" Nullable="false"/>
<Property Name="Title" Type="String" Nullable="false" />
<Property Name="BirthDate" Type="DateTime" Nullable="false" />
<Property Name="MaritalStatus" Type="String" Nullable="false"
/>
<Property Name="Gender" Type="String" Nullable="false"/>
<Property Name="HireDate" Type="DateTime" Nullable="false" />
<Property Name="SalariedFlag" Type="Boolean" Nullable="false" />
<Property Name="VacationHours" Type="Int16" Nullable="false" />
<Property Name="SickLeaveHours" Type="Int16" Nullable="false" />
<Property Name="CurrentFlag" Type="Boolean" Nullable="false" />
<Property Name="rowguid" Type="Guid" Nullable="false" />
<Property Name="ModifiedDate" Type="DateTime" Nullable="false" />
</EntityType>
<Association Name="Employee_EmployeeManagerID">
<End Role="Employee" Type="Self.Employee" Multiplicity="0..1" />
<End Role="Employee" Type="Self.Employee" Multiplicity="0..*" />
</Association>
<EntityContainer Name="HumanResources">
<EntitySet Name="Department" EntityType="Self.Department" />
<EntitySet Name="Employee" EntityType="Self.Employee" />
<AssociationSet Name="Employee_EmployeeManagerID"
Association="Self.Employee_EmployeeManagerID">
<End Role="Employee" EntitySet="Employee" />
<End Role="Employee63" EntitySet="Employee" />
</AssociationSet>
</EntityContainer>
</Schema>
Le specifiche di schema CSDL sono mappate alle specifiche SSDL (Store Schema Definition Language) in MSDL (Mapping Specification Language).
Contenuto della sezione
Negli argomenti di questa sezione vengono descritti i tipi e gli elementi utilizzati per implementare un modello a oggetti compilato in base a EDM. L'attributo Namespace dell'elemento Schema e gli elementi figlio dell'elemento Schema, ad esempio EntityType e Association, sono descritti negli argomenti seguenti:
Ognuno di questi tipi dispone di elementi figlio nello schema CSDL.
Vedere anche
Concetti
Elemento EntityContainer (CSDL)
Implementazione di entità (EDM)
Implementazione delle associazioni (EDM)