Share via


RelationshipManager.GetRelatedEnd(String, String) Method

Definition

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

public System.Data.Entity.Core.Objects.DataClasses.IRelatedEnd GetRelatedEnd (string relationshipName, string targetRoleName);
member this.GetRelatedEnd : string * string -> System.Data.Entity.Core.Objects.DataClasses.IRelatedEnd
Public Function GetRelatedEnd (relationshipName As String, targetRoleName As String) As IRelatedEnd

Parameters

relationshipName
String

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

targetRoleName
String

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

Returns

IRelatedEnd representing the EntityCollection<TEntity> or EntityReference<TEntity> that was retrieved.

Exceptions

relationshipName or targetRoleName is null.

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

targetRoleName is invalid or unable to find the relationship type in the metadata.

Applies to