Freigeben über


InsertFunction (AssociationSetMapping)

Als untergeordnetes Element eines AssociationSetMapping-Elements im Entity Data Model (EDM) definiert das InsertFunction-Element in einem ModificationFunctionMapping-Element die gespeicherte Prozedur, mit der eine Zuordnung zwischen Entitäten erstellt wird.

Um diese Zuordnung zu erstellen, ordnet das InsertFunction-Element die Schlüsseleigenschaften der Entitäten an den Enden einer Association den Parametern einer gespeicherten Prozedur im Speichermodell zu. Die gespeicherte Prozedur erstellt neue Instanzen des Association-Elements in Speicher.

Das InsertFunction-Element legt mithilfe seiner untergeordneten EndProperty-Elemente die Enden des zuzuordnenden Association-Elements fest.

NoteHinweis

Im Gegensatz zur InsertFunction in einem AssociationSetMapping-Element enthält das InsertFunction-Element in einem EntityTypeMapping-Element keine untergeordneten EndProperty-Elemente. Stattdessen enthält das InsertFunction-Element in einem EntityTypeMapping-Element ein AssociationEnd-Element, das Zuordnungen festlegt, auf die von der zu erstellenden Entität verwiesen werden kann. Weitere Informationen finden Sie unter InsertFunction (EntityTypeMapping) und AssociationEnd (EntityTypeMapping).

Beispiel

Im folgenden Beispiel ordnet das InsertFunction-Element eine gespeicherte Prozedur zu, die neue Instanzen einer Association zwischen einer Contact-Entität und einer Address-Entität im "Adventureworks Sales"-Modell erstellt. Die untergeordneten ScalarProperty-Elemente der EndProperty -Elemente ordnen die Identitätseigenschaften der Contact-Entität und der Address-Entität den Parametern der gespeicherten Prozedur zu, die von den ParameterName-Attributen angegeben werden.

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

Siehe auch

Konzepte

Unterstützung für gespeicherte Prozeduren (Entity Framework)
DeleteFunction (AssociationSetMapping)
ModificationFunctionMapping (AssociationSetMapping)
AssociationSetMapping-Element (MSL)
EndProperty (AssociationSet ModificationFunctionMapping)