Share via


RelationshipManager.InitializeRelatedCollection<TTargetEntity> Method

Definition

Takes an existing EntityCollection that was created with the default constructor and initializes it using the provided relationship and target role names. This method is designed to be used during deserialization only, and will throw an exception if the provided EntityCollection has already been initialized, or if the relationship manager is already attached to a 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))

Type Parameters

TTargetEntity

Type of the entity represented by targetRoleName

Parameters

relationshipName
String

The relationship name.

targetRoleName
String

The target role name.

entityCollection
EntityCollection<TTargetEntity>

An existing EntityCollection.

Attributes

Applies to