Export (0) Print
Expand All

RelationshipManager.GetRelatedEnd Method

Returns either an EntityCollection<TEntity> or EntityReference<TEntity> of the correct type for the specified target role in a relationship.

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

public IRelatedEnd GetRelatedEnd(
	string relationshipName,
	string targetRoleName


Type: System.String

Name of the relationship in which targetRoleName is defined. The relationship name is not namespace qualified.

Type: System.String

Target role to use to retrieve the other end of relationshipName.


relationshipName or targetRoleName is null.


The source type does not match the type of the owner.


targetRoleName is invalid.


Unable to find the relationship type in the metadata.

This method is intended to be used in scenarios where the user does not have full metadata, including the static type information for both ends of the relationship. This metadata is specified in the EdmRelationshipAttribute object on each entity type in the relationship, so the metadata system can retrieve it based on the supplied relationship name and target role name.

The relationship name should not be namespace qualified. An error occurs when you prepend the namespace to the relationship name.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft