Share via


RelationshipManager.InitializeRelatedReference<TTargetEntity> Método

Definição

Inicializa uma EntityReference<TEntity> existente que foi criada usando o construtor sem parâmetros.

public:
generic <typename TTargetEntity>
 where TTargetEntity : class, System::Data::Objects::DataClasses::IEntityWithRelationships void InitializeRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName, System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ entityReference);
public:
generic <typename TTargetEntity>
 where TTargetEntity : class void InitializeRelatedReference(System::String ^ relationshipName, System::String ^ targetRoleName, System::Data::Objects::DataClasses::EntityReference<TTargetEntity> ^ entityReference);
[System.ComponentModel.Browsable(false)]
public void InitializeRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName, System.Data.Objects.DataClasses.EntityReference<TTargetEntity> entityReference) where TTargetEntity : class, System.Data.Objects.DataClasses.IEntityWithRelationships;
[System.ComponentModel.Browsable(false)]
public void InitializeRelatedReference<TTargetEntity> (string relationshipName, string targetRoleName, System.Data.Objects.DataClasses.EntityReference<TTargetEntity> entityReference) where TTargetEntity : class;
[<System.ComponentModel.Browsable(false)>]
member this.InitializeRelatedReference : string * string * System.Data.Objects.DataClasses.EntityReference<'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.InitializeRelatedReference : string * string * System.Data.Objects.DataClasses.EntityReference<'argetEntity (requires 'argetEntity : null)> -> unit (requires 'argetEntity : null)
Public Sub InitializeRelatedReference(Of TTargetEntity As {Class, IEntityWithRelationships}) (relationshipName As String, targetRoleName As String, entityReference As EntityReference(Of TTargetEntity))
Public Sub InitializeRelatedReference(Of TTargetEntity As Class) (relationshipName As String, targetRoleName As String, entityReference As EntityReference(Of TTargetEntity))

Parâmetros de tipo

TTargetEntity

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

Parâmetros

relationshipName
String

O nome da relação.

targetRoleName
String

O nome da função do fim relacionado.

entityReference
EntityReference<TTargetEntity>

O EntityReference<TEntity> a ser inicializado.

Atributos

Exceções

Quando o EntityReference<TEntity> fornecido já foi inicializado.

- ou -

Quando o gerenciador de relacionamento já está anexado a um ObjectContext.

- ou -

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

Comentários

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

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

Aplica-se a