RelationshipManager.InitializeRelatedReference<TTargetEntity> Method

Definition

Takes an existing EntityReference 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 EntityReference has already been initialized, if the relationship manager already contains a relationship with this name and target role, or if the relationship manager is already attached to a ObjectContext.W

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

Type Parameters

TTargetEntity

The type of the EntityReference<TEntity> being initialized.

Parameters

relationshipName
String

The relationship name.

targetRoleName
String

The role name of the related end.

entityReference
EntityReference<TTargetEntity>

The EntityReference<TEntity> to initialize.

Attributes

Exceptions

When the provided EntityReference<TEntity> is already initialized.-or-When the relationship manager is already attached to an ObjectContext or when the relationship manager already contains a relationship with this name and target role.

Applies to