Compartilhar via


RelationshipManager.GetRelatedCollection<TTargetEntity> Método

Definição

Obtém um EntityCollection<TEntity> de objetos relacionados com o nome da relação especificada e o nome da função de destino.

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)

Parâmetros de tipo

TTargetEntity

O tipo do retornado EntityCollection<TEntity>.

Parâmetros

relationshipName
String

Nome da relação para navegar. O nome da relação não é qualificado de namespace.

targetRoleName
String

Nome da função de destino para a navegação. Indica a direção de navegação em toda a relação.

Retornos

EntityCollection<TTargetEntity>

O EntityCollection<TEntity> de objetos relacionados.

Exceções

A função especificada retornou um EntityReference<TEntity>, em vez de um EntityCollection<TEntity>.

Comentários

Obtém um EntityCollection<TEntity> dos objetos relacionados que têm o nome da relação e o nome da função de destino especificados.

O nome da relação não deve ser qualificado para namespace. Ocorre um erro quando você anexa o namespace ao nome da relação.

Aplica-se a