次の方法で共有


ReferentialConstraint 要素 (SSDL)

ストア スキーマ定義言語 (SSDL) の ReferentialConstraint 要素は、基になるデータベースにおける外部キー制約 (参照整合性制約とも呼ばれる) を表します。 制約のプリンシパル End と依存 End は、それぞれ Principal 子要素と Dependent 子要素によって指定されます。 プリンシパル End と依存 End に参加する列は、PropertyRef 要素で参照します。

typelib 要素は Association 要素の子要素で、省略可能です。 Association 要素に指定されている外部キー制約のマッピングに ReferentialConstraint 要素が使用されない場合は、AssociationSetMapping 要素を使用してこれを行う必要があります。

The ReferentialConstraint element can have the following child elements:

適用可能な属性

ReferentialConstraint 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。 However, custom attributes may not belong to any XML namespace that is reserved for SSDL. カスタム属性の完全修飾名は一意である必要があります。

次の例は、ReferentialConstraint 要素を使用して FK_CustomerOrders 外部キー制約に参加する列を指定する Association 要素を示しています。

<Association Name="FK_CustomerOrders">
  <End Role="Customers" 
       Type="ExampleModel.Store.Customers" Multiplicity="1">
    <OnDelete Action="Cascade" />
  </End>
  <End Role="Orders" 
       Type="ExampleModel.Store.Orders" Multiplicity="*" />
  <ReferentialConstraint>
    <Principal Role="Customers">
      <PropertyRef Name="CustomerId" />
    </Principal>
    <Dependent Role="Orders">
      <PropertyRef Name="CustomerId" />
    </Dependent>
  </ReferentialConstraint>
</Association>

参照

概念

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

その他のリソース

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