RelationshipManager.InitializeRelatedCollection<TTargetEntity> Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise un existant EntityCollection<TEntity> 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 de l’initialisation EntityCollection<TEntity> .
Paramètres
- relationshipName
- String
Nom de la relation.
- targetRoleName
- String
Nom du rôle de la fin associée.
- entityCollection
- EntityCollection<TTargetEntity>
À EntityCollection<TEntity> initialiser.
- Attributs
Exceptions
Lorsque l’élément fourni EntityCollection<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 InitializeRelatedCollection méthode initialise un existant EntityCollection<TEntity> créé à l’aide du constructeur sans paramètre. Il EntityCollection<TEntity> est initialisé à l’aide des noms de rôles de relation et de cible fournis.
La InitializeRelatedCollection méthode est utilisée uniquement pendant la désérialisation.