次の方法で共有


Name 属性 (EntityContainer CSDL)

EntityContainer 要素の Name 属性は、エンティティ データ モデル (EDM) 上に構築されたオブジェクト モデルのクラスの名前を指定します。概念スキーマ定義言語 (CSDL) の EntityContainer に割り当てられた Name は、プログラミング可能なクラスをストレージ構造にマップするためにマッピング スキーマで使用されます。概念スキーマのストレージ メタデータへのマッピングの詳細については、「EntityContainerMapping 要素 (MSL)」を参照してください。

XML 階層では、スキーマに EntityContainer が定義されている場合でも、EntityContainer 要素は Schema 要素から独立しています。これは、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 Complete Model (EDM)