RelationshipManager.InitializeRelatedCollection<TTargetEntity> Méthode

Définition

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

Paramètres de type

TTargetEntity

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

Paramètres

relationshipName
String

Nom de la relation.

targetRoleName
String

Nom de rôle de la terminaison connexe.

entityCollection
EntityCollection<TTargetEntity>

Objet EntityCollection<TEntity> à initialiser.

Attributs

Exceptions

Lorsque l'objet EntityCollection<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 InitializeRelatedCollection méthode initialise un existant EntityCollection<TEntity> qui a été créé à l’aide du constructeur sans paramètre. L'objet EntityCollection<TEntity> est initialisé à l'aide des noms de relation et de rôle cible fournis.

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

S’applique à