RelationshipManager.InitializeRelatedCollection<TTargetEntity> Método

Definição

Inicializa um existente EntityCollection<TEntity> que foi criado usando o construtor sem parâmetros.

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

Parâmetros de tipo

TTargetEntity

O tipo do EntityCollection<TEntity> que está sendo inicializado.

Parâmetros

relationshipName
String

O nome da relação.

targetRoleName
String

O nome da função do final relacionado.

entityCollection
EntityCollection<TTargetEntity>

O EntityCollection<TEntity> para inicializar.

Atributos

Exceções

Quando o fornecido EntityCollection<TEntity> já estiver inicializado.

-ou-

Quando o gerenciador de relacionamentos já estiver anexado a um ObjectContext.

-ou-

Quando o gerenciador de relacionamentos já contém uma relação com esse nome e função de destino.

Comentários

O InitializeRelatedCollection método inicializa um existente EntityCollection<TEntity> que foi criado usando o construtor sem parâmetros. O EntityCollection<TEntity> valor é inicializado usando a relação fornecida e os nomes de função de destino.

O InitializeRelatedCollection método é usado somente durante a desserialização.

Aplica-se a