RelationshipManager.InitializeRelatedReference<TTargetEntity> Método

Definição

Inicializa um existente EntityReference<TEntity> que foi criado 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 Genérico

TTargetEntity

O tipo de EntityReference<TEntity> ser inicializado.

Parâmetros

relationshipName
String

O nome da relação.

targetRoleName
String

O nome do papel do fim relacionado.

entityReference
EntityReference<TTargetEntity>

O EntityReference<TEntity> para inicializar.

Atributos

Exceções

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

-ou-

Quando o gestor de relações já está ligado a um ObjectContext.

-ou-

Quando o gestor de relações já tem uma relação com esse nome e função alvo.

Observações

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 dos papéis-alvo.

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

Aplica-se a