RelationshipManager.GetRelatedReference<TTargetEntity> Método

Definição

Obtém o EntityReference<TEntity> nome de um objeto relacionado usando a combinação especificada de nome de relação e 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 a ser navegada. O nome da relação não é qualificado para namespace.

targetRoleName
String

Nome da função de destino para a navegação. Indica a direção da navegação na 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ê prepara o namespace para o nome da relação.

Aplica-se a