RelationshipManager Class
Used to track relationships between objects in the object context.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
The RelationshipManager type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Create | Creates a new RelationshipManager object. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAllRelatedEnds | Returns an enumeration of all the related ends managed by the relationship manager. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetRelatedCollection<TTargetEntity> | Gets an EntityCollection<TEntity> of related objects with the specified relationship name and target role name. |
![]() | GetRelatedEnd | Returns either an EntityCollection<TEntity> or EntityReference<TEntity> of the correct type for the specified target role in a relationship. |
![]() | GetRelatedReference<TTargetEntity> | Gets the EntityReference<TEntity> for a related object by using the specified combination of relationship name and target role name. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeRelatedCollection<TTargetEntity> | Initializes an existing EntityCollection<TEntity> that was created by using the default constructor. |
![]() | InitializeRelatedReference<TTargetEntity> | Initializes an existing EntityReference<TEntity> that was created by using the default constructor. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | OnDeserialized | Infrastructure. Used internally to deserialize entity objects along with the RelationshipManager instances. |
![]() | OnSerializing | Called by Object Services to prepare an EntityKey for binary serialization with a serialized relationship. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
RelationshipManager is used to track relationships between objects in an object context. There is one instance of the RelationshipManager class for each relationship tracked in the object context. Relationships are defined by associations in a conceptual model. For more information, see Association (EDM).
The example in this topic is based on the Adventure Works Sales Model. The example adds new SalesOrderHeader entities to the Contact entity. Then it gets all related ends from the Contact entity and displays the relationship name, source role name, and target role name for each related end.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
