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

 

Copies the scalar values from the supplied object into set of original values for the object in the ObjectContext that has the same key.

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

public virtual TEntity ApplyOriginalValues<TEntity>(
	string entitySetName,
	TEntity originalEntity
)
where TEntity : class

Parameters

entitySetName
Type: System.String

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

originalEntity
Type: TEntity

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

Return Value

Type: TEntity

The updated object.

Type Parameters

TEntity

The type of the entity object.

Exception Condition
ArgumentNullException

entitySetName or original is null.

InvalidOperationException

The EntitySet from entitySetName does not match the EntitySet of the object EntityKey or an ObjectStateEntry for the object cannot be found in the ObjectStateManager or the object is in an Added or a Detached state or the entity key of the supplied object is invalid or has property changes.

ArgumentException

entitySetName is an empty string.