ObjectContext.ApplyOriginalValues<TEntity>(String, TEntity) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從提供的物件將純量值複製至 ObjectContext 中具有相同索引鍵之物件的原始值組。
public virtual TEntity ApplyOriginalValues<TEntity>(string entitySetName, TEntity originalEntity) where TEntity : class;
abstract member ApplyOriginalValues : string * 'Entity -> 'Entity (requires 'Entity : null)
override this.ApplyOriginalValues : string * 'Entity -> 'Entity (requires 'Entity : null)
Public Overridable Function ApplyOriginalValues(Of TEntity As Class) (entitySetName As String, originalEntity As TEntity) As TEntity
類型參數
- TEntity
實體物件的型別。
參數
- entitySetName
- String
此物件所屬之實體集的名稱。
- originalEntity
- TEntity
具有要套用至物件之原始值的已中斷連結物件。 originalEntity 的實體索引鍵必須符合 EntityKey 中 ObjectContext 專案的屬性。
傳回
TEntity
更新的物件。
例外狀況
entitySetName 或 original 為 null。
EntitySet來自 entitySetName 的 不符合 EntitySet 物件的 EntityKey ,或 ObjectStateEntry 物件在 中 ObjectStateManager 找不到,或物件處於 Added 或 Detached 狀態,或提供之物件的實體索引鍵無效或有屬性變更。
entitySetName 是空字串。