Share via


Dependent 要素 (CSDL)

概念スキーマ定義言語 (CSDL) の Dependent 要素は、ReferentialConstraint 要素の子要素であり、参照制約の依存 End を定義します。 ReferentialConstraint 要素は、リレーショナル データベースの参照整合性制約と同様の機能を定義します。 In the same way that a column (or columns) from a database table can reference the primary key of another table, a property (or properties) of an entity type can reference the entity key of another entity type. 参照されるエンティティ型は、制約のプリンシパル End と呼ばれます。 プリンシパル End を参照するエンティティ型は、制約の依存 End と呼ばれます。 PropertyRef 要素は、プリンシパル End を参照するキーを指定するために使用されます。

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

適用可能な属性

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

属性名 必須 Value

Role

有効

アソシエーションの依存 End 上のエンティティ型の名前。

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

次の例は、ReferentialConstraint 要素を PublishedBy アソシエーションの定義の一部として使用する方法を示します。 Book エンティティ型の PublisherId プロパティは、参照制約の依存 End を構成します。

<Association Name="PublishedBy">
  <End Type="BooksModel.Book" Role="Book" Multiplicity="*" >
  </End>
  <End Type="BooksModel.Publisher" Role="Publisher" Multiplicity="1" />
  <ReferentialConstraint>
    <Principal Role="Publisher">
      <PropertyRef Name="Id" />
    </Principal>
    <Dependent Role="Book">
      <PropertyRef Name="PublisherId" />
    </Dependent>
  </ReferentialConstraint>
</Association>

参照

概念

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

その他のリソース

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