RelationshipManager.GetRelatedCollection<TTargetEntity> 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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>相关对象。
例外
指定的角色返回了一个 EntityReference<TEntity> 而不是一个 EntityCollection<TEntity>。
注解
EntityCollection<TEntity>获取具有指定关系名称和目标角色名称的相关对象。
关系名称不应限定命名空间。 将命名空间追加到关系名称之前时,会发生错误。