作为实体数据模型 (EDM) 中 AssociationSetMapping 元素的子元素,ModificationFunctionMapping 元素中的 InsertFunction 元素标识在实体间创建关联的存储过程。
为创建此关联,InsertFunction 元素将 Association 两端的实体的键属性映射到存储模型中的存储过程的参数。该存储过程创建存储中的 Association 元素的新实例。
为指定要映射的 Association 元素的两端,InsertFunction 元素使用其 EndProperty 子元素。
| .gif) 注意 | 
|---|
| 与 AssociationSetMapping 元素中的 InsertFunction 不同,EntityTypeMapping 元素中的 InsertFunction 元素不包含 EndProperty 子元素。但 EntityTypeMapping 元素中的 InsertFunction 元素包含一个 AssociationEnd 元素,此元素映射正在创建的实体可能引用的关联。有关更多信息,请参见 InsertFunction (EntityTypeMapping) 和 AssociationEnd (EntityTypeMapping)。 | 
示例
在下面的示例中,InsertFunction 元素映射一个存储过程,该存储过程在 Adventureworks 销售模型中的 Contact 实体和 Address 实体之间创建 Association 的新实例。EndProperty 元素的每个 ScalarProperty 子元素都将 Contact 和 Address 实体的标识属性 (Property) 映射到 ParameterName 属性 (Attribute) 指定的存储过程参数。
      <InsertFunction
        FunctionName="ContactInformationModel.Store.SetAddress">
        <EndProperty Name="Address">
          <ScalarProperty Name="AddressID" ParameterName="AddressID"/>
        </EndProperty>
        <EndProperty Name="Contact">
          <ScalarProperty Name="ContactID" ParameterName="ContactID"/>
        </EndProperty>
      </InsertFunction>
另请参见
概念
存储过程支持(实体框架)
DeleteFunction (AssociationSetMapping)
ModificationFunctionMapping (AssociationSetMapping)
AssociationSetMapping 元素 (MSL)
EndProperty (AssociationSet ModificationFunctionMapping)