RelationshipManager.InitializeRelatedCollection<TTargetEntity> 方法

定义

采用使用默认构造函数创建的现有 EntityCollection,并使用提供的关系和目标角色名称对其进行初始化。 此方法设计为仅在反序列化期间使用,如果提供的 EntityCollection 已初始化,或者关系管理器已附加到 ObjectContext,则会引发异常。

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public void InitializeRelatedCollection<TTargetEntity> (string relationshipName, string targetRoleName, System.Data.Entity.Core.Objects.DataClasses.EntityCollection<TTargetEntity> entityCollection) where TTargetEntity : class;
member this.InitializeRelatedCollection : string * string * System.Data.Entity.Core.Objects.DataClasses.EntityCollection<'argetEntity (requires 'argetEntity : null)> -> unit (requires 'argetEntity : null)
Public Sub InitializeRelatedCollection(Of TTargetEntity As Class) (relationshipName As String, targetRoleName As String, entityCollection As EntityCollection(Of TTargetEntity))

类型参数

TTargetEntity

targetRoleName 表示的实体的类型

参数

relationshipName
String

关系名。

targetRoleName
String

目标角色名称。

entityCollection
EntityCollection<TTargetEntity>

现有的 EntityCollection。

属性

适用于