Condividi tramite


Metodo RelationshipManager.InitializeRelatedCollection<TTargetEntity>

[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]

Accetta un elemento EntityCollection esistente creato con il costruttore predefinito e lo inizializza utilizzando i nomi del ruolo di destinazione e della relazione specificati. Questo metodo è destinato esclusivamente alla deserializzazione e verrà generata un'eccezione se l'elemento EntityCollection specificato è già stato inizializzato o se il gestore delle relazioni è già collegato a un elemento ObjectContext.

Spazio dei nomi:  System.Data.Entity.Core.Objects.DataClasses
Assembly:  EntityFramework (in EntityFramework.dll)

Sintassi

'Dichiarazione
<BrowsableAttribute(False)> _
<EditorBrowsableAttribute(EditorBrowsableState.Never)> _
Public Sub InitializeRelatedCollection(Of TTargetEntity As Class) ( _
    relationshipName As String, _
    targetRoleName As String, _
    entityCollection As EntityCollection(Of TTargetEntity) _
)
'Utilizzo
Dim instance As RelationshipManager 
Dim relationshipName As String 
Dim targetRoleName As String 
Dim entityCollection As EntityCollection(Of TTargetEntity)

instance.InitializeRelatedCollection(relationshipName, _
    targetRoleName, entityCollection)
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
public void InitializeRelatedCollection<TTargetEntity>(
    string relationshipName,
    string targetRoleName,
    EntityCollection<TTargetEntity> entityCollection
)
where TTargetEntity : class
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState::Never)]
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class 
void InitializeRelatedCollection(
    String^ relationshipName, 
    String^ targetRoleName, 
    EntityCollection<TTargetEntity>^ entityCollection
)
[<BrowsableAttribute(false)>]
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
member InitializeRelatedCollection : 
        relationshipName:string * 
        targetRoleName:string * 
        entityCollection:EntityCollection<'TTargetEntity> -> unit   when 'TTargetEntity : not struct
JScript does not support generic types and methods.

Parametri di tipo

  • TTargetEntity
    Tipo dell'entità rappresentata da targetRoleName

Parametri

  • targetRoleName
    Tipo: System.String
    Nome del ruolo di destinazione.

Vedere anche

Riferimento

RelationshipManager Classe

Spazio dei nomi System.Data.Entity.Core.Objects.DataClasses