Share via


Principal 要素 (CSDL)

概念スキーマ定義言語 (CSDL) の Principal 要素は、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 Principal element can have the following child elements (in the order listed):

適用可能な属性

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

属性名 必須 Value

Role

有効

アソシエーションのプリンシパル End 上のエンティティ型の名前。

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

次の例は、PublishedBy アソシエーションの定義の一部である ReferentialConstraint 要素を示します。 Publisher エンティティ型の Id プロパティは、参照制約のプリンシパル 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)
Dependent 要素 (CSDL)

その他のリソース

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