UpdateFunction 要素 (MSL)

マッピング仕様言語 (MSL) の UpdateFunction 要素は、概念モデルのエンティティ型の更新関数を基になるデータベースのストアド プロシージャにマップします。 変更関数のマップ先であるストアド プロシージャは、ストレージ モデル内で宣言する必要があります。 詳細については、「Function 要素 (SSDL)」を参照してください。

Cc716696.note(ja-jp,VS.100).gif注 :
エンティティ型の挿入、更新、および削除の 3 つの操作をすべてストアド プロシージャにマップしないと、マップされていない操作は実行時に失敗して UpdateException がスローされます。

UpdateFunction 要素は ModificationFunctionMapping 要素の子になることができ、EntityTypeMapping 要素に適用できます。

The UpdateFunction element can have the following child elements:

適用可能な属性

The following table describes the attributes that can be applied to the UpdateFunction element.

属性名 必須 Value

FunctionName

有効

更新関数のマップ先となるストアド プロシージャの名前空間修飾名。 ストアド プロシージャはストレージ モデル内で宣言する必要があります。

RowsAffectedParameter

いいえ

影響を受ける行の数を返す出力パラメーターの名前。

次の例は、School モデルに基づいており、Person エンティティ型の更新関数を UpdatePerson ストアド プロシージャにマッピングする UpdateFunction 要素を示しています。 The UpdatePerson stored procedure is declared in the storage model.

<EntityTypeMapping TypeName="SchoolModel.Person">
  <ModificationFunctionMapping>
    <InsertFunction FunctionName="SchoolModel.Store.InsertPerson">
      <ScalarProperty Name="EnrollmentDate"
                      ParameterName="EnrollmentDate" />
      <ScalarProperty Name="HireDate" ParameterName="HireDate" />
      <ScalarProperty Name="FirstName" ParameterName="FirstName" />
      <ScalarProperty Name="LastName" ParameterName="LastName" />
      <ResultBinding Name="PersonID" ColumnName="NewPersonID" />
    </InsertFunction>
    <UpdateFunction FunctionName="SchoolModel.Store.UpdatePerson">
      <ScalarProperty Name="EnrollmentDate"
                      ParameterName="EnrollmentDate"
                      Version="Current" />
      <ScalarProperty Name="HireDate" ParameterName="HireDate"
                      Version="Current" />
      <ScalarProperty Name="FirstName" ParameterName="FirstName"
                      Version="Current" />
      <ScalarProperty Name="LastName" ParameterName="LastName"
                      Version="Current" />
      <ScalarProperty Name="PersonID" ParameterName="PersonID"
                      Version="Current" />
    </UpdateFunction>
    <DeleteFunction FunctionName="SchoolModel.Store.DeletePerson">
      <ScalarProperty Name="PersonID" ParameterName="PersonID" />
    </DeleteFunction>
  </ModificationFunctionMapping>
</EntityTypeMapping>

参照

その他のリソース

CSDL、SSDL、および MSL 仕様
モデリングとマッピング (Entity Framework)