RelationshipManager::GetRelatedCollection<TTargetEntity> Method (String^, String^)
Gets an EntityCollection<TEntity> of related objects with the specified relationship name and target role name.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
public: generic<typename TTargetEntity> where TTargetEntity : ref class EntityCollection<TTargetEntity>^ GetRelatedCollection( String^ relationshipName, String^ targetRoleName )
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.
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>. |
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.
Available since 3.5