Share via


RelationshipManager.InitializeRelatedReference<TTargetEntity> Méthode

Définition

Initialise un EntityReference<TEntity> existant qui a été créé à l’aide du constructeur sans paramètre.

public:
generic <typename TTargetEntity>
 where TTargetEntity : class, System::Data::Objects::DataClasses::IEntityWithRelationships void InitializeRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName, System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ entityReference);
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, System.Data.Objects.DataClasses.IEntityWithRelationships;
[System.ComponentModel.Browsable(false)]
public void InitializeRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName, System.Data.Objects.DataClasses.EntityReference<TTargetEntity> entityReference) where TTargetEntity : class;
[<System.ComponentModel.Browsable(false)>]
member this.InitializeRelatedReference : string * string * System.Data.Objects.DataClasses.EntityReference<'argetEntity (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)> -> unit (requires 'argetEntity : null and 'argetEntity :> System.Data.Objects.DataClasses.IEntityWithRelationships)
[<System.ComponentModel.Browsable(false)>]
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, IEntityWithRelationships}) (relationshipName As String, targetRoleName As String, entityReference As EntityReference(Of TTargetEntity))
Public Sub InitializeRelatedReference(Of TTargetEntity As Class) (relationshipName As String, targetRoleName As String, entityReference As EntityReference(Of TTargetEntity))

Paramètres de type

TTargetEntity

Type du EntityReference<TEntity> en cours d'initialisation.

Paramètres

relationshipName
String

Nom de la relation.

targetRoleName
String

Nom de rôle de la terminaison connexe.

entityReference
EntityReference<TTargetEntity>

Objet EntityReference<TEntity> à initialiser.

Attributs

Exceptions

Lorsque l'objet EntityReference<TEntity> fourni est déjà initialisé.

- ou -

Lorsque le gestionnaire de relations est déjà attaché à un objet ObjectContext.

- ou -

Lorsque le gestionnaire de relations contient déjà une relation avec ce nom et ce rôle cible.

Remarques

La InitializeRelatedReference méthode initialise un existant EntityReference<TEntity> qui a été créé à l’aide du constructeur sans paramètre. L'objet EntityReference<TEntity> est initialisé à l'aide des noms de relation et de rôle cible fournis.

La méthode InitializeRelatedReference est utilisée uniquement lors de la désérialisation.

S’applique à