共用方式為


RelationshipManager.GetRelatedReference<TTargetEntity> 方法

定義

使用關聯性名稱和目標角色名稱的指定組合,取得相關物件的 EntityReference<TEntity>

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)

類型參數

TTargetEntity

傳回之 EntityReference<TEntity> 的型別。

參數

relationshipName
String

要巡覽之關聯性的名稱。 此關聯性名稱不符合命名空間。

targetRoleName
String

巡覽之目標角色的名稱。 表示巡覽關聯性的方向。

傳回

EntityReference<TTargetEntity>

相關物件的 EntityReference<TEntity>

例外狀況

備註

此關聯性名稱不應該符合命名空間。 當您在關聯性名稱前面加上命名空間時,就會發生錯誤。

適用於