RelationshipManager.InitializeRelatedReference<TTargetEntity> Méthode

Définition

Initialise un existant EntityReference<TEntity> 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 de l’initialisation EntityReference<TEntity> .

Paramètres

relationshipName
String

Nom de la relation.

targetRoleName
String

Nom du rôle de la fin associée.

entityReference
EntityReference<TTargetEntity>

À EntityReference<TEntity> initialiser.

Attributs

Exceptions

Lorsque l’élément fourni EntityReference<TEntity> est déjà initialisé.

-ou-

Lorsque le gestionnaire de relations est déjà attaché à un 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> créé à l’aide du constructeur sans paramètre. Il EntityReference<TEntity> est initialisé à l’aide des noms de rôles de relation et de cible fournis.

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

S’applique à