RelationshipManager.GetRelatedReference<TTargetEntity> Método

Definição

Obtém o EntityReference<TEntity> para um objeto relacionado usando a combinação especificada do nome da relação e do nome do papel do 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 Genérico

TTargetEntity

O tipo do retornado EntityReference<TEntity>.

Parâmetros

relationshipName
String

Nome da relação a gerir. O nome da relação não qualifica o namespace.

targetRoleName
String

Nome do papel alvo para a navegação. Indica a direção da navegação através da relação.

Devoluções

EntityReference<TTargetEntity>

O EntityReference<TEntity> de um objeto relacionado.

Exceções

O papel especificado devolveu um EntityCollection<TEntity> em vez de um EntityReference<TEntity>.

Observações

O nome da relação não deve ser qualificado para o namespace. Ocorre um erro quando se coloca o namespace no nome da relação.

Aplica-se a