ストア スキーマ定義言語 (SSDL) 内の OnDelete 要素は、外部キー制約に関与している行が削除されるときのデータベースの動作を反映します。 アクションが Cascade に設定されている場合は、削除される行を参照している行も削除されます。 アクションが None に設定されている場合、削除される行を参照している行は削除されません。 OnDelete 要素は、End 要素の子要素です。
An OnDelete element can have the following child elements (in the order listed):
Documentation (0 個または 1 個)
Annotation 要素 (0 個以上)
適用可能な属性
The following table describes the attributes that can be applied to the OnDelete element.
属性名 | 必須 | Value |
---|---|---|
Action |
有効 |
Cascade または None。 (Restricted の値は有効ですが、None と同じ動作になります)。 |
![]() |
---|
OnDelete 要素には、任意の数の annotation 属性 (カスタム XML 属性) を適用できます。However, custom attributes may not belong to any XML namespace that is reserved for SSDL.カスタム属性の完全修飾名は一意である必要があります。 |
例
次の例では、FK_CustomerOrders 外部キー制約を定義する Association 要素を示します。 OnDelete 要素は、Customers テーブル内の行が削除される場合、Customers テーブル内の特定の行を参照している Orders テーブル内のすべての行も削除されることを示します。
<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>