Export (0) Print
Expand All

RelationshipManager.GetRelatedCollection<TTargetEntity> Method

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

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

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

Type Parameters

TTargetEntity

The type of the returned EntityCollection<TEntity>.

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.

Return Value

Type: System.Data.Objects.DataClasses.EntityCollection<TTargetEntity>
The EntityCollection<TEntity> of related objects.

ExceptionCondition
InvalidOperationException

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

Gets an EntityCollection<TEntity> of related objects that have the specified 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.

Show:
© 2014 Microsoft