Schema 項目 (SSDL)
在 實體資料模型 (EDM) 中,Schema 項目是存放中繼資料規格內的根項目 (Root Element)。Schema 項目包含了使用儲存模型之名稱和資料型別之實體與關聯的宣告和定義。儲存中繼資料是定義在存放結構定義語言 (SSDL) 中。
EntityType 和 Association 項目是 Schema 項目的子項目。EntitySet 和 AssociationSet 項目是 EntityContainer 項目的子項目。
EntityContainer 項目是由 Schema 項目所容納,但它在邏輯上是分開且獨立的。在對應規格中,概念結構描述中的 EntityContainer 會對應到儲存中繼資料內的 EntityContainer,而不需要參考結構描述命名空間。
下列 SSDL 結構描述摘錄會顯示 Schema 項目以及它所包含之最重要的子項目。
<?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>
下列主題將描述 Schema 型別的 Namespace 屬性及 Schema 項目的子項目 (例如 EntityType 和 Association),連同其函式。
這些型別在 SSDL 結構描述中都有子項目。
另請參閱
概念
EntityContainer 項目 (SSDL)
實作實體 (EDM)
實作關聯 (EDM)