Edit

Share via


ObjectStateManager.TryGetRelationshipManager Method

Definition

Returns the RelationshipManager that is used by the specified object.

public:
 bool TryGetRelationshipManager(System::Object ^ entity, [Runtime::InteropServices::Out] System::Data::Objects::DataClasses::RelationshipManager ^ % relationshipManager);
public bool TryGetRelationshipManager (object entity, out System.Data.Objects.DataClasses.RelationshipManager relationshipManager);
member this.TryGetRelationshipManager : obj * RelationshipManager -> bool
Public Function TryGetRelationshipManager (entity As Object, ByRef relationshipManager As RelationshipManager) As Boolean

Parameters

entity
Object

The object for which to return the RelationshipManager.

relationshipManager
RelationshipManager

When this method returns, contains the RelationshipManager for the entity.

Returns

true if a RelationshipManager instance was returned for the supplied entity; otherwise false.

Remarks

The GetRelationshipManager method is used to obtain the RelationshipManager for objects that are persistence ignorant. When objects implement IEntityWithRelationships or inherit from EntityObject, the RelationshipManager is accessed from the RelationshipManager property.

The RelationshipManager cannot be returned when the object is in a Detached state.

Calling the TryGetRelationshipManager method is the same as calling the GetRelationshipManager method, except that this method returns false instead of raising an exception.

Applies to