Поделиться через


InsertFunction (AssociationSetMapping

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

To create this association, the InsertFunction element maps the key properties of entities at the ends of an Association to parameters of a stored procedure in the storage model. The stored procedure creates new instances of the Association element in storage.

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

Note

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

Example

In the following example, the InsertFunction element maps a stored procedure that creates new instances of an Association between a Contact entity and an Address entity in the Adventureworks sales model. Each ScalarProperty child element of the EndProperty elements maps the identity properties of the Contact and Address entities to the stored-procedure parameters that the ParameterName attributes specify.

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

See Also

Concepts

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