RelationshipManager.GetRelatedCollection<TTargetEntity> 方法

定义

获取具有指定关系名称和目标角色名称的相关对象的 EntityCollection<TEntity>

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

类型参数

TTargetEntity

返回的 EntityCollection<TEntity> 的类型。

参数

relationshipName
String

要浏览的关系的名称。 关系名称不由命名空间限定。

targetRoleName
String

要浏览的目标角色的名称。 指示在关系中浏览的方向。

返回

EntityCollection<TTargetEntity>

相关对象的 EntityCollection<TEntity>

例外

注解

获取具有指定关系名称和目标角色名称的相关对象的 EntityCollection<TEntity>

关系名称不应由命名空间限定。 如果将命名空间置于关系名称之前,将发生错误。

适用于