相关文章推荐
性感的小虾米  ·  米家无线除螨仪- 知乎·  1 年前    · 
八块腹肌的小狗  ·  联发科Helio ...·  1 年前    · 
果断的面包  ·  [Tumor ...·  1 年前    · 

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge public enum EntityState
[System.Flags]
[System.ComponentModel.DataAnnotations.BindableType(IsBindable=false)]
public enum EntityState
[<System.Flags>]
type EntityState = 
[<System.Flags>]
[<System.ComponentModel.DataAnnotations.BindableType(IsBindable=false)>]
type EntityState = 
Public Enum EntityState
Inheritance
EntityState

The object exists but is not being tracked. An entity is in this state immediately after it has been created and before it is added to the object context. An entity is also in this state after it has been removed from the context by calling the Detach(Object) method or if it is loaded by using a NoTracking MergeOption . There is no ObjectStateEntry instance associated with objects in the Detached state.

One of the scalar properties on the object was modified and the SaveChanges() method has not been called. In POCO entities without change-tracking proxies, the state of the modified properties changes to Modified when the DetectChanges() method is called. After the changes are saved, the object state changes to Unchanged .

Remarks

The object context must know the state of an object to save changes back to the data source. ObjectStateEntry objects store EntityState information. The SaveChanges methods of the ObjectContext process entities that are attached to the context and update the data source depending on the EntityState of each object. For more information, see Creating, Adding, Modifying, and Deleting Objects .

The state of objects inside an object context is managed by the ObjectStateManager . To find out the state of an object, call one of the following ObjectStateManager methods: TryGetObjectStateEntry , GetObjectStateEntry , or GetObjectStateEntries . The State property of the ObjectStateEntry defines the state of the object.

Applies to