RelationshipManager.InitializeRelatedReference(String, String, EntityReference<TTargetEntity>) RelationshipManager.InitializeRelatedReference(String, String, EntityReference<TTargetEntity>) RelationshipManager.InitializeRelatedReference(String, String, EntityReference<TTargetEntity>) RelationshipManager.InitializeRelatedReference(String, String, EntityReference<TTargetEntity>) Method

Definition

Initializes an existing EntityReference<TEntity> that was created by using the default constructor.

public:
generic <typename TTargetEntity>
 where TTargetEntity : class void InitializeRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName, System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ entityReference);
[System.ComponentModel.Browsable(false)]
public void InitializeRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName, System.Data.Objects.DataClasses.EntityReference<TTargetEntity> entityReference) where TTargetEntity : class;
member this.InitializeRelatedReference : string * string * System.Data.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 String String String

The relationship name.

targetRoleName
String String String String

The role name of the related end.

entityReference
EntityReference<TTargetEntity>

The EntityReference<TEntity> to initialize.

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.

Remarks

The InitializeRelatedReference method initializes an existing EntityReference<TEntity> that was created by using the default constructor. The EntityReference<TEntity> is initialized by using the provided relationship and target role names.

The InitializeRelatedReference method is used during deserialization only.

Applies to