ObjectContext.ApplyCurrentValues<TEntity> Method (String, TEntity)

 

Copies the scalar values from the supplied object into the object in the ObjectContext that has the same key.

Namespace:   System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

public virtual TEntity ApplyCurrentValues<TEntity>(
	string entitySetName,
	TEntity currentEntity
)
where TEntity : class

Parameters

entitySetName
Type: System.String

The name of the entity set to which the object belongs.

currentEntity
Type: TEntity

The detached object that has property updates to apply to the original object. The entity key of currentEntity must match the EntityKey property of an entry in the ObjectContext .

Return Value

Type: TEntity

The updated object.

Type Parameters

TEntity

The entity type of the object.

Exception Condition
ArgumentNullException

entitySetName or current is null.

InvalidOperationException

The EntitySet from entitySetName does not match the EntitySet of the object EntityKey or the object is not in the ObjectStateManager or it is in a Detached state or the entity key of the supplied object is invalid.

ArgumentException

entitySetName is an empty string.