RelationshipManager.InitializeRelatedReference<TTargetEntity>(String, String, EntityReference<TTargetEntity>) Método

Definição

Inicializa uma EntityReference<TEntity> existente que foi criada usando o construtor sem parâmetros.Initializes an existing EntityReference<TEntity> that was created by using the parameterless constructor.

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.The type of the EntityReference<TEntity> being initialized.

Parâmetros

relationshipName
String

O nome da relação.The relationship name.

targetRoleName
String

O nome da função do fim relacionado.The role name of the related end.

entityReference
EntityReference<TTargetEntity>

O EntityReference<TEntity> a ser inicializado.The EntityReference<TEntity> to initialize.

Atributos

Exceções

Quando o EntityReference<TEntity> fornecido já foi inicializado.When the provided EntityReference<TEntity> is already initialized.

- ou --or-

Quando o gerenciador de relacionamento já está anexado a um ObjectContext.When the relationship manager is already attached to an ObjectContext.

- ou --or-

Quando o gerenciador de relacionamento já contém uma relação com essa função de destino e nome.When the relationship manager already contains a relationship with this name and target role.

Comentários

O InitializeRelatedReference método inicializa um existente EntityReference<TEntity> que foi criado usando o construtor sem parâmetros.The InitializeRelatedReference method initializes an existing EntityReference<TEntity> that was created by using the parameterless constructor. O EntityReference<TEntity> é inicializado usando a relação fornecida e os nomes da função de destino.The EntityReference<TEntity> is initialized by using the provided relationship and target role names.

O InitializeRelatedReference método é usado durante a desserialização apenas.The InitializeRelatedReference method is used during deserialization only.

Aplica-se a