RelationshipManager.GetRelatedCollection<TTargetEntity> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an EntityCollection<TEntity> of related objects with the specified relationship name and target role name.
public:
generic <typename TTargetEntity>
where TTargetEntity : class, System::Data::Objects::DataClasses::IEntityWithRelationships System::Data::Objects::DataClasses::EntityCollection<TTargetEntity> ^ GetRelatedCollection(System::String ^ relationshipName, System::String ^ targetRoleName);
public:
generic <typename TTargetEntity>
where TTargetEntity : class System::Data::Objects::DataClasses::EntityCollection<TTargetEntity> ^ GetRelatedCollection(System::String ^ relationshipName, System::String ^ targetRoleName);
public System.Data.Objects.DataClasses.EntityCollection<TTargetEntity> GetRelatedCollection<TTargetEntity> (string relationshipName, string targetRoleName) where TTargetEntity : class, System.Data.Objects.DataClasses.IEntityWithRelationships;
public System.Data.Objects.DataClasses.EntityCollection<TTargetEntity> GetRelatedCollection<TTargetEntity> (string relationshipName, string targetRoleName) where TTargetEntity : class;
member this.GetRelatedCollection : string * string -> System.Data.Objects.DataClasses.EntityCollection<'argetEntity (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)> (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)
member this.GetRelatedCollection : string * string -> System.Data.Objects.DataClasses.EntityCollection<'argetEntity (requires 'argetEntity : null)> (requires 'argetEntity : null)
Public Function GetRelatedCollection(Of TTargetEntity As {Class, IEntityWithRelationships}) (relationshipName As String, targetRoleName As String) As EntityCollection(Of TTargetEntity)
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
The EntityCollection<TEntity> of related objects.
Exceptions
The specified role returned an EntityReference<TEntity> instead of an EntityCollection<TEntity>.
Remarks
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.