語言

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 的實體索引鍵必須符合 EntityKey 中 ObjectContext 專案的屬性。

傳回

TEntity

更新的物件。

例外狀況

entitySetName 或 current 為 null。

EntitySetfrom entitySetName 與 物件的 不相符 EntitySet ,或物件 EntityKey 不在 ObjectStateManager 中,或處於 Detached 狀態,或提供之物件的實體索引鍵無效。

entitySetName 是空字串。

適用於