共用方式為


EntityContainer 項目 (SSDL)

存放結構定義語言 (SSDL) 中定義的 EntityContainer 是用來描述將會保存物件模型上建置之應用程式資料之容器的中繼資料,該物件模型是使用 實體資料模型 EDM 所定義。EntityContainer 通常是關聯式資料庫管理系統 (RDMS) 中的資料庫,例如 SQL Server。

SSDL 結構描述的命名空間名稱以及它所包含的 EntityContainer 項目,都會對應到概念結構定義語言 (CSDL) 結構描述的對應命名空間名稱以及此命名空間所包含的 EntityContainer 項目。在 XML 階層中,EntityContainer 項目與 Schema 項目分開,即使 EntityContainer 定義在結構描述內亦然。將實體容器對應到儲存區時,這是非常重要的一點。在對應檔中,EntityContainer 的完整類別名稱不包含結構描述命名空間名稱。

如需對應 EntityContainer 的詳細資訊,請參閱 EntityContainerMapping 項目 (MSL)

SSDL 語法是一種中繼資料,可定義 EDM 上建置之應用程式所使用的儲存模型。下列範例中宣告的 EntityContainer 是資料庫物件。它所包含的每一個實體集都代表 Adventure Works 資料庫之 Human Resources 資料分割內的資料表。下列語法包含員工、部門、員工地址、員工過去歷史等內容的實體集。HumanResourcesEntityContainer 定義為 AdventureWorksHRTarget 命名空間的一部分。在建置過程當中,出現的每一個 Self 別名都將會擴充到這個命名空間名稱。

  <EntityContainer Name="HumanResources">
    <EntitySet Name="Department" EntityType="Self.Department" />
    <EntitySet Name="Employee" EntityType="Self.Employee" />
    <EntitySet Name="EmployeeAddress" EntityType="Self.EmployeeAddress" />
    <EntitySet Name="EmployeeDepartmentHistory"
                    EntityType="Self.EmployeeDepartmentHistory" />
    <EntitySet Name="EmployeePayHistory"
                              EntityType="Self.EmployeePayHistory" />
    <EntitySet Name="JobCandidate" EntityType="Self.JobCandidate" />
    <EntitySet Name="Shift" EntityType="Self.Shift" />
    <AssociationSet Name="FK_Employee_Employee_ManagerID"
        Association="Self.FK_Employee_Employee_ManagerID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="Employee1" EntitySet="Employee" />
    </AssociationSet>
    <AssociationSet Name="JobCandidate_Employee_EmployeeID"
             Association="Self.FK_JobCandidate_Employee_EmployeeID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="JobCandidate" EntitySet="JobCandidate" />
    </AssociationSet>
  </EntityContainer>

如需這個 EntityContainer 中所定義之實體集和關聯集的詳細資訊,請參閱本章節的以下主題:

Name 屬性 (EntityContainer SSDL)

EntitySet 項目 (EntityContainer SSDL)

AssociationSet 項目 (EntityContainer SSDL)

另請參閱

概念

實體集 (EDM)
關聯集 (EDM)
EntityContainerMapping 項目 (MSL)
AdventureWorks 完整模型 (EDM)