Share via


RelationshipManager.GetRelatedCollection<TTargetEntity> Method

Definition

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

public System.Data.Entity.Core.Objects.DataClasses.EntityCollection<TTargetEntity> GetRelatedCollection<TTargetEntity> (string relationshipName, string targetRoleName) where TTargetEntity : class;
member this.GetRelatedCollection : string * string -> System.Data.Entity.Core.Objects.DataClasses.EntityCollection<'argetEntity (requires 'argetEntity : null)> (requires 'argetEntity : null)
Public Function GetRelatedCollection(Of TTargetEntity As Class) (relationshipName As String, targetRoleName As String) As EntityCollection(Of TTargetEntity)

Type Parameters

TTargetEntity

The type of the returned EntityCollection<TEntity>.

Parameters

relationshipName
String

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

targetRoleName
String

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

Returns

EntityCollection<TTargetEntity>

The EntityCollection<TEntity> of related objects.

Exceptions

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

Applies to