RelationshipManager.GetRelatedEnd Method (String, String)

 
System_CAPS_noteNote

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

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
)

Parameters

relationshipName
Type: System.String

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

targetRoleName
Type: System.String

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

Exception Condition
ArgumentNullException

relationshipName or targetRoleName is null.

InvalidOperationException

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

ArgumentException

targetRoleName is invalid.

-or-

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
Available since 3.5
Return to top
Show: