concept ObjectStateManager in category .net

This is an excerpt from Manning's book Entity Framework 4 in Action.
The Object Services layer is the gateway to accessing data from the database and sending it back. As a result, this component is the most important for developers. Object Services is responsible for materialization—the process of transforming the data obtained from the Entity Client data provider, which has a tabular structure, into objects. Another important part of this layer is the ObjectStateManager object, or state manager, which tracks any changes made to the objects.
The AcceptAllChanges method takes all entities that are in Added and Modified states and marks them as Unchanged. It then detaches entities in Deleted state and eventually updates the ObjectStateManager entries (more on this in section 6.3).
The first step is hooking up the SavingChanges event
. Next, in the handler, you retrieve all entries in a specific state by using the ObjectStateManager class’s GetObjectStateEntries method
. It accepts an EntityState parameter representing the state to look for, and it returns a collection of all entries in that state. If you need entries in different states, you can combine them using the flag syntax. Eventually, you invoke the logger method to write the entry
.
. Next, in the handler, you retrieve all entries in a specific state by using the ObjectStateManager class’s GetObjectStateEntries method
. It accepts an EntityState parameter representing the state to look for, and it returns a collection of all entries in that state. If you need entries in different states, you can combine them using the flag syntax. Eventually, you invoke the logger method to write the entry
.