Elemento Schema (SSDL)
In Entity Data Model (EDM) l'elemento Schema è l'elemento radice in una specifica dei metadati di archiviazione. L'elemento Schema contiene dichiarazioni e definizioni di entità e associazioni che utilizzano i nomi e i tipi di dati del modello di archiviazione. I metadati di archiviazione sono definiti in SSDL (Store Schema Definition Language).
Gli elementi EntityType e Association sono elementi figlio dell'elemento Schema. Gli elementi EntitySet e AssociationSet sono elementi figlio dell'elemento EntityContainer.
L'elemento EntityContainer è contenuto nell'elemento Schema, ma è separato e indipendente dal punto di vista logico. Nella specifica di mapping l'oggetto EntityContainer dello schema concettuale è mappato all'oggetto EntityContainer nei metadati di archiviazione senza riferimento allo spazio dei nomi dello schema.
Nell'estratto di schema SSDL seguente vengono illustrati l'elemento Schema e i più importanti elementi figlio da esso contenuti.
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="AdventureWorksHRTarget" Alias="Self"
xmlns="https://schemas.microsoft.com/ado/2006/04/edm/ssdl">
<EntityType Name="Department">
<Key>
<PropertyRef Name="DepartmentID">
</Key>
<Property Name="DepartmentID" Type="smallint"
Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Name" Type="nvarchar"
Nullable="false" MaxLength="50" />
<Property Name="GroupName" Type="nvarchar"
Nullable="false" MaxLength="50" />
<Property Name="ModifiedDate" Type="datetime" Nullable="false" />
</EntityType>
<EntityType Name="Employee" >
<Key>
<PropertyRef Name="EmployeeID">
</Key>
<Property Name="EmployeeID" Type="int" Nullable="false"
StoreGeneratedPattern="Identity" />
<Property Name="NationalIDNumber" Type="nvarchar"
Nullable="false" MaxLength="15" />
<Property Name="ContactID" Type="int" Nullable="false" />
<Property Name="LoginID" Type="nvarchar"
Nullable="false" MaxLength="256" />
<Property Name="ManagerID" Type="int" />
<Property Name="Title" Type="nvarchar" Nullable="false"
MaxLength="50" />
<Property Name="BirthDate" Type="datetime" Nullable="false" />
<Property Name="MaritalStatus" Type="nchar" Nullable="false"
MaxLength="1" FixedLength="true" />
<Property Name="Gender" Type="nchar" Nullable="false"
MaxLength="1" FixedLength="true" />
<Property Name="HireDate" Type="datetime" Nullable="false" />
<Property Name="SalariedFlag" Type="bit" Nullable="false" />
<Property Name="VacationHours" Type="smallint" Nullable="false" />
<Property Name="SickLeaveHours" Type="smallint" Nullable="false" />
<Property Name="CurrentFlag" Type="bit" Nullable="false" />
<Property Name="rowguid" Type="uniqueidentifier" Nullable="false" />
<Property Name="ModifiedDate" Type="datetime" Nullable="false" />
</EntityType>
<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="Employee" EntitySet="Employee" />
</AssociationSet>
</EntityContainer>
</Schema>
L'attributo Namespace del tipo Schema e gli elementi figlio dell'elemento Schema, ad esempio EntityType e Association, sono descritti, con le relative funzioni, negli argomenti seguenti:
Ognuno di questi tipi dispone di elementi figlio nello schema SSDL.
Vedere anche
Concetti
Elemento EntityContainer (SSDL)
Implementazione di entità (EDM)
Implementazione delle associazioni (EDM)