ObjectContext.ApplyCurrentValues<TEntity>(String, TEntity) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將所提供物件的標量值複製到具有相同鍵的物件 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 為空。
EntitySet fromentitySetName 與 的 不符EntitySetEntityKey,或物件不在 ,ObjectStateManager或處於Detached狀態,或所提供物件的實體鍵無效。
entitySetName 是一個空字串。