Name 屬性 (EntityContainer CSDL)

EntityContainer 項目的 Name 屬性會指定在 實體資料模型 (EDM) 上建置之物件模型中的類別名稱。概念結構定義語言 (CSDL) 中指派給 EntityContainerName 會在對應規格中使用,以便將可程式化類別對應到儲存結構。如需將概念結構描述對應到儲存中繼資料的詳細資訊,請參閱 EntityContainerMapping 項目 (MSL)

在 XML 階層中,EntityContainer 項目與 Schema 項目分開,即使 EntityContainer 定義在結構描述內亦然。將 EntityContainer 對應到儲存區時,這是非常重要的一點。在對應檔中,EntityContainer 的名稱不包含結構描述命名空間名稱。

在隨後的程式碼範例中,會在開啟項目中指派 Name

<EntityContainer Name="HumanResources">.

下列結構描述範例示範 Adventure Works CSDL 結構描述範例中的 EntityContainer

  <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="Employee_Employee_ManagerID"
                     Association="Self.Employee_Employee_ManagerID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="EmployeeManager" EntitySet="Employee" />
    </AssociationSet>
    <AssociationSet Name="JobCandidate_Employee_EmployeeID"
                 Association="Self.JobCandidate_Employee_EmployeeID">
      <End Role="Employee" EntitySet="Employee" />
      <End Role="JobCandidate" EntitySet="JobCandidate" />
    </AssociationSet>
  </EntityContainer>

如需此範例中顯示之實體集和關聯集的詳細資訊,請參閱 EntitySet 項目 (EntityContainer CSDL)AssociationSet 項目 (EntityContainer CSDL)

另請參閱

概念

EntityContainer 項目 (SSDL)
EntityContainerMapping 項目 (MSL)
EntitySetMapping 項目 (MSL)
實體容器 (EDM)
AdventureWorks 完整模型 (EDM)