次の方法で共有


ObjectContext.ApplyCurrentValues<TEntity> メソッド

[このページは、Entity Framework 6 に関するページです。最新バージョンは、'Entity Framework' NuGet パッケージとして入手できます。Entity Framework の詳細については、msdn.com/data/ef を参照してください。]

指定されたオブジェクトのスカラー値を、同じキーを持つ ObjectContext のオブジェクトにコピーします。

名前空間:  System.Data.Entity.Core.Objects
アセンブリ:  EntityFramework (EntityFramework.dll 内)

構文

'宣言
Public Overridable Function ApplyCurrentValues(Of TEntity As Class) ( _
    entitySetName As String, _
    currentEntity As TEntity _
) As TEntity
'使用
Dim instance As ObjectContext 
Dim entitySetName As String 
Dim currentEntity As TEntity
Dim returnValue As TEntity

returnValue = instance.ApplyCurrentValues(entitySetName, _
    currentEntity)
public virtual TEntity ApplyCurrentValues<TEntity>(
    string entitySetName,
    TEntity currentEntity
)
where TEntity : class
public:
generic<typename TEntity>
where TEntity : ref class 
virtual TEntity ApplyCurrentValues(
    String^ entitySetName, 
    TEntity currentEntity
)
abstract ApplyCurrentValues : 
        entitySetName:string * 
        currentEntity:'TEntity -> 'TEntity  when 'TEntity : not struct 
override ApplyCurrentValues : 
        entitySetName:string * 
        currentEntity:'TEntity -> 'TEntity  when 'TEntity : not struct
JScript does not support generic types and methods.

型パラメーター

  • TEntity
    オブジェクトのエンティティ型。

パラメーター

  • entitySetName
    型 : System.String
    オブジェクトが属しているエンティティ セットの名前。
  • currentEntity
    型 : TEntity
    元のオブジェクトに適用するプロパティ更新を含むデタッチしたオブジェクト。 currentEntity のエンティティ キーは、ObjectContext 内のエントリの EntityKey プロパティと一致する必要があります。

戻り値

型 : TEntity
更新後のオブジェクト。

例外

例外 状態
ArgumentNullException

entitySetName または current が null です。

InvalidOperationException

entitySetName からの EntitySet がオブジェクト EntityKeyEntitySet と一致しないか、オブジェクトが ObjectStateManager にないか、オブジェクトが Detached 状態であるか、指定されたオブジェクトのエンティティ キーが無効か、いずれかのケースに該当します。

ArgumentException

entitySetName が空の文字列です。

参照

参照

ObjectContext クラス

System.Data.Entity.Core.Objects 名前空間