ObjectContext.ApplyCurrentValues<TEntity>(String, TEntity) 方法

定义

将标量值从提供的对象复制到 ObjectContext 中具有相同键的对象中。

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

类型参数

TEntity

对象的实体类型。

参数

entitySetName
String

对象所属实体集的名称。

currentEntity
TEntity

其属性更新将应用于原始对象的已分离对象。 currentEntity 的实体键必须与 中ObjectContext某个条目的 属性匹配EntityKey

返回

TEntity

已更新的对象。

例外

entitySetName 或 current 为 null。

EntitySet from entitySetName 与 对象的 EntityKey 不匹配EntitySet,或者对象不在 中ObjectStateManager,或者它处于Detached状态或所提供的对象的实体键无效。

entitySetName 是一个空字符串。

适用于