ObjectStateManager.GetObjectStateEntry Method (Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns an ObjectStateEntry for the specified object.

Namespace:   System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public ObjectStateEntry GetObjectStateEntry(
	object entity


Type: System.Object

The Object to which the retrieved ObjectStateEntry belongs.

Return Value

Type: System.Data.Objects.ObjectStateEntry

The corresponding ObjectStateEntry for the given Object.

Exception Condition

No entity for the specified Object exists in the ObjectStateManager.

Use the TryGetObjectStateEntry(Object, ObjectStateEntry) method to return an ObjectStateEntry object without having to handle the InvalidOperationException raised by the GetObjectStateEntry(Object) method.

.NET Framework
Available since 3.5
Return to top