Of course, before we can work with the state metadata, we need to obtain a reference to the object that represents it. Both the
DbContext expose methods to retrieve the state entry for a specific entity or a collection of entries:
To retrieve the state entry for a specific entity, you use the
ObjectStateManager.GetObjectStateEntry() method in the
ObjectContext API, or the
Entry() method of the
ObjectContext provides an
ObjectStateManager.GetObjectStateEntries() method that retrieves all the entries by their state. To filter the results by entity type or set, you can use LINQ operators ...