RelationshipManager.InitializeRelatedCollection<TTargetEntity> Metoda

Definice

Inicializuje existující EntityCollection<TEntity> , který byl vytvořen pomocí konstruktoru bez parametrů.

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

Parametry typu

TTargetEntity

Typ EntityCollection<TEntity> inicializace.

Parametry

relationshipName
String

Název relace.

targetRoleName
String

Název role souvisejícího konce.

entityCollection
EntityCollection<TTargetEntity>

Inicializace EntityCollection<TEntity> .

Atributy

Výjimky

Pokud je zadaný EntityCollection<TEntity> již inicializován.

nebo

Pokud je správce vztahů již připojen k objektu ObjectContext.

nebo

Pokud správce relací již obsahuje relaci s tímto názvem a cílovou rolí.

Poznámky

Metoda InitializeRelatedCollection inicializuje existující EntityCollection<TEntity> , který byl vytvořen pomocí konstruktoru bez parametrů. Inicializuje se EntityCollection<TEntity> pomocí poskytnuté relace a názvů cílových rolí.

Metoda InitializeRelatedCollection se používá pouze při deserializaci.

Platí pro