Share via


Association 要素 (SSDL)

ストア スキーマ定義言語 (SSDL) の Association 要素は、基盤となるデータベースの外部キー制約に参加するテーブル列を指定します。 必要な 2 つの子 End 要素 は、アソシエーションの端のテーブルと両端の多重度を指定します。 オプションの ReferentialConstraint 要素 は、アソシエーションのプリンシパル End と依存 End、および参加する列を指定します。 ReferentialConstraint 要素がない場合は、AssociationSetMapping 要素 を使用してアソシエーションの列マッピングを指定する必要があります。

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

適用可能な属性

The following table describes the attributes that can be applied to the Association element.

属性名 必須 Value

Name

有効

基盤となるデータベースの対応する外部キー制約の名前。

Bb399576.note(ja-jp,VS.100).gif注 :
Association 要素には、任意の数の 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