EntitySet 要素 (CSDL)

概念スキーマ定義言語の EntitySet 要素は、エンティティ型のインスタンス、およびそのエンティティ型から派生した任意の型のインスタンスの論理コンテナーです。 エンティティ型とエンティティ セットの間のリレーションシップは、リレーショナル データベースの行とテーブルの間のリレーションシップと似ています。 エンティティ型は、行と同様に関連データのセットを定義し、エンティティ セットには、テーブルと同様に、その定義のインスタンスが含まれます。 エンティティ セットは、エンティティ型のインスタンスをグループ化するための構造を提供します。これにより、データ ソース内の関連するデータ構造に、エンティティ型のインスタンスをマッピングできるようになります。 詳細については、「EntityContainerMapping 要素 (MSL)」および「EntitySetMapping 要素 (MSL)」を参照してください。

特定のエンティティ型に対して複数のエンティティ セットを定義できます。

Bb387139.note(ja-jp,VS.100).gif注 :
Entity Data Model Designer (エンティティ デザイナー) では、型ごとに複数のエンティティ セットを含んでいる概念モデルはサポートされません。

The EntitySet element can have the following child elements (in the order listed):

適用可能な属性

The table below describes the attributes that can be applied to the EntitySet element.

属性名 必須 Value

Name

有効

エンティティ セットの名前。

EntityType

有効

エンティティ型の完全修飾名。そのインスタンスは、エンティティ セットに格納されます。

Bb387139.note(ja-jp,VS.100).gif注 :
EntitySet 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。However, custom attributes may not belong to any XML namespace that is reserved for CSDL.カスタム属性の完全修飾名は一意である必要があります。

The following example shows an EntityContainer element with three EntitySet elements:

<EntityContainer Name="BooksContainer" >
  <EntitySet Name="Books" EntityType="BooksModel.Book" />
  <EntitySet Name="Publishers" EntityType="BooksModel.Publisher" />
  <EntitySet Name="Authors" EntityType="BooksModel.Author" />
  <AssociationSet Name="PublishedBy" Association="BooksModel.PublishedBy">
    <End Role="Book" EntitySet="Books" />
    <End Role="Publisher" EntitySet="Publishers" />
  </AssociationSet>
  <AssociationSet Name="WrittenBy" Association="BooksModel.WrittenBy">
    <End Role="Book" EntitySet="Books" />
    <End Role="Author" EntitySet="Authors" />
  </AssociationSet>
</EntityContainer>

It is possible to define multiple entity sets per type (MEST). 次の例は、Book エンティティ型の 2 つのエンティティ セットを持つエンティティ コンテナーを定義します。

<EntityContainer Name="BooksContainer" >
  <EntitySet Name="Books" EntityType="BooksModel.Book" />
  <EntitySet Name="FictionBooks" EntityType="BooksModel.Book" />
  <EntitySet Name="Publishers" EntityType="BooksModel.Publisher" />
  <EntitySet Name="Authors" EntityType="BooksModel.Author" />
  <AssociationSet Name="PublishedBy" Association="BooksModel.PublishedBy">
    <End Role="Book" EntitySet="Books" />
    <End Role="Publisher" EntitySet="Publishers" />
  </AssociationSet>
  <AssociationSet Name="BookAuthor" Association="BooksModel.BookAuthor">
    <End Role="Book" EntitySet="Books" />
    <End Role="Author" EntitySet="Authors" />
  </AssociationSet>
</EntityContainer>

参照

概念

エンティティ フレームワークの概要
CSDL 仕様
EntityContainer 要素 (CSDL)

その他のリソース

CSDL、SSDL、および MSL 仕様
ADO.NET Entity Data Model Tools
entity set (Entity Data Model)