RelationshipManager.GetRelatedCollection<TTargetEntity> Method (String, String)

 

Gets an EntityCollection<TEntity> of related objects with the specified relationship name and target role name.

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

public EntityCollection<TTargetEntity> GetRelatedCollection<TTargetEntity>(
	string relationshipName,
	string targetRoleName
)
where TTargetEntity : class

Parameters

relationshipName
Type: System.String

Name of the relationship to navigate. The relationship name is not namespace qualified.

targetRoleName
Type: System.String

Name of the target role for the navigation. Indicates the direction of navigation across the relationship.

Type Parameters

TTargetEntity

The type of the returned EntityCollection<TEntity>.

Exception Condition
InvalidOperationException

The specified role returned an EntityReference<TEntity> instead of an EntityCollection<TEntity> .