Share via


DeleteFunction (AssociationSetMapping)

As a child element of an AssociationSetMapping element in the Entity Data Model (EDM), the DeleteFunction element in a ModificationFunctionMapping element identifies the stored procedure that deletes an association between entities.

To delete this association, the DeleteFunction element maps the key properties of entities at the ends of an Association in the storage schema to the parameters of a stored procedure in the storage model. The stored procedure deletes instances of the Association in storage.

To specify the ends of the Association that is being mapped, the DeleteFunction element uses its EndProperty child elements.

Note

Unlike the DeleteFunction in an AssociationSetMapping element, the DeleteFunction element in an EntityTypeMapping element does not contain EndProperty child elements. Instead, the DeleteFunction element in an EntityTypeMapping element includes an AssociationEnd element that maps associations the entity being created might reference. For more information, see DeleteFunction (EntityTypeMapping) and AssociationEnd (EntityTypeMapping).

Example

In the following example, the DeleteFunction element maps a stored procedure that deletes instances of the Contact_Address Association in the Adventureworks sales model. The ScalarProperty child elements of the EndProperty elements map the identity properties of the Contact and Address entities to the stored-procedure parameters that the ParameterName attributes specify.

      <DeleteFunction
        FunctionName="ContactInformationModel.Store.DeleteAddress">
        <EndProperty Name="Address">
          <ScalarProperty Name="AddressID" ParameterName="AddressID"/>
        </EndProperty>
        <EndProperty Name="Contact">
          <ScalarProperty Name="ContactID" ParameterName="ContactID"/>
        </EndProperty>
      </DeleteFunction>

See Also

Tasks

How to: Define a Model with a Stored Procedure (Entity Framework)

Concepts

InsertFunction (AssociationSetMapping
Stored Procedure Support (Entity Framework)
ModificationFunctionMapping (AssociationSetMapping)
EndProperty (AssociationSet ModificationFunctionMapping)
AssociationSetMapping Element (MSL)