Compartilhar via


RelationshipManager.GetRelatedReference<TTargetEntity> Método

Definição

Obtém o EntityReference<TEntity> para um objeto relacionado usando a combinação especificada de nome da relação e o nome da função de destino.

public:
generic <typename TTargetEntity>
 where TTargetEntity : class, System::Data::Objects::DataClasses::IEntityWithRelationships System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ GetRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName);
public:
generic <typename TTargetEntity>
 where TTargetEntity : class System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ GetRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName);
public System.Data.Objects.DataClasses.EntityReference<TTargetEntity> GetRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName) where TTargetEntity : class, System.Data.Objects.DataClasses.IEntityWithRelationships;
public System.Data.Objects.DataClasses.EntityReference<TTargetEntity> GetRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName) where TTargetEntity : class;
member this.GetRelatedReference : string * string -> System.Data.Objects.DataClasses.EntityReference<'argetEntity (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)> (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)
member this.GetRelatedReference : string * string -> System.Data.Objects.DataClasses.EntityReference<'argetEntity (requires 'argetEntity : null)> (requires 'argetEntity : null)
Public Function GetRelatedReference(Of TTargetEntity As {Class, IEntityWithRelationships}) (relationshipName As String, targetRoleName As String) As EntityReference(Of TTargetEntity)
Public Function GetRelatedReference(Of TTargetEntity As Class) (relationshipName As String, targetRoleName As String) As EntityReference(Of TTargetEntity)

Parâmetros de tipo

TTargetEntity

O tipo do retornado EntityReference<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

EntityReference<TTargetEntity>

O EntityReference<TEntity> de um objeto relacionado.

Exceções

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

Comentários

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