RelationshipManager.InitializeRelatedCollection<TTargetEntity> Metodo

Definizione

Inizializza un oggetto esistente EntityCollection<TEntity> creato utilizzando il costruttore senza parametri.

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))

Parametri di tipo

TTargetEntity

Tipo dell'oggetto EntityCollection<TEntity> da inizializzare.

Parametri

relationshipName
String

Nome della relazione.

targetRoleName
String

Nome del ruolo dell'estremità correlata.

entityCollection
EntityCollection<TTargetEntity>

Oggetto EntityCollection<TEntity> da inizializzare.

Attributi

Eccezioni

Quando l'oggetto specificato EntityCollection<TEntity> è già inizializzato.

oppure

Quando il gestore delle relazioni è già collegato a un oggetto ObjectContext.

oppure

Quando il gestore delle relazioni contiene già una relazione con questo nome e il ruolo di destinazione.

Commenti

Il InitializeRelatedCollection metodo inizializza un oggetto esistente EntityCollection<TEntity> creato utilizzando il costruttore senza parametri. L'oggetto EntityCollection<TEntity> viene inizializzato utilizzando la relazione fornita e i nomi dei ruoli di destinazione.

Il InitializeRelatedCollection metodo viene utilizzato solo durante la deserializzazione.

Si applica a