Condividi tramite


RelationshipManager.GetRelatedReference<TTargetEntity> Metodo

Definizione

Ottiene l'oggetto EntityReference<TEntity> per un oggetto correlato utilizzando il nome della relazione e il nome del ruolo di destinazione specificati.

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)

Parametri di tipo

TTargetEntity

Tipo dell'oggetto EntityReference<TEntity> restituito.

Parametri

relationshipName
String

Nome della relazione per la navigazione. Il nome della relazione non è qualificato con lo spazio dei nomi.

targetRoleName
String

Nome del ruolo di destinazione per la navigazione. Indica la direzione di navigazione nella relazione.

Restituisce

EntityReference<TTargetEntity>

Oggetto EntityReference<TEntity> di un oggetto correlato.

Eccezioni

Il ruolo specificato ha restituito un oggetto EntityCollection<TEntity> anziché un oggetto EntityReference<TEntity>.

Commenti

Il nome della relazione non deve essere qualificato con lo spazio dei nomi. Si verifica un errore quando si antepone lo spazio dei nomi al nome della relazione.

Si applica a