Share via


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

Definition

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

public virtual TEntity ApplyCurrentValues<TEntity> (string entitySetName, TEntity currentEntity) where TEntity : class;
abstract member ApplyCurrentValues : string * 'Entity -> 'Entity (requires 'Entity : null)
override this.ApplyCurrentValues : string * 'Entity -> 'Entity (requires 'Entity : null)
Public Overridable Function ApplyCurrentValues(Of TEntity As Class) (entitySetName As String, currentEntity As TEntity) As TEntity

Type Parameters

TEntity

The entity type of the object.

Parameters

entitySetName
String

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

currentEntity
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 .

Returns

TEntity

The updated object.

Exceptions

entitySetName or current is null.

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.

entitySetName is an empty string.

Applies to