OnDelete Element (Association CSDL)

In the Entity Data Model (EDM), the OnDelete child element of an End element specifies what happens when you delete an entity that has a relationship to another entity. This action is recommended when the relationship models a foreign key constraint in the data source that has been defined with ON DELETE CASCADE. However, it is not required that the same OnDelete action be specified in both the conceptual model and the storage model. The association in the following example defines a referentially constrained relationship between a SalesOrderHeader entity and one or more SalesOrderDetail entities. When a SalesOrderHeader entity is deleted, all related SalesOrderDetail entities are also deleted.

  <Association Name="FK_SalesOrderDetail_SalesOrderHeader_SalesOrderID">
    <End Role="SalesOrderHeader" Type="AdvWrksSalesModel.SalesOrderHeader" Multiplicity="1">
      <OnDelete Action="Cascade" />
    <End Role="SalesOrderDetail" Type="AdvWrksSalesModel.SalesOrderDetail" Multiplicity="*" />
      <Principal Role="SalesOrderHeader">
        <PropertyRef Name="SalesOrderID" />
      <Dependent Role="SalesOrderDetail">
        <PropertyRef Name="SalesOrderID" />

See Also

Community Additions