RelationshipManager.InitializeRelatedReference<TTargetEntity> Método

Definición

Inicializa un existente EntityReference<TEntity> que se creó mediante el constructor sin 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

Tipo del EntityReference<TEntity> objeto que se va a inicializar.

Parámetros

relationshipName
String

Nombre de la relación.

targetRoleName
String

Nombre del rol del extremo relacionado.

entityReference
EntityReference<TTargetEntity>

que EntityReference<TEntity> se va a inicializar.

Atributos

Excepciones

Cuando el elemento proporcionado EntityReference<TEntity> ya está inicializado.

O bien

Cuando el administrador de relaciones ya está asociado a .ObjectContext

O bien

Cuando el administrador de relaciones ya contiene una relación con este nombre y el rol de destino.

Comentarios

El InitializeRelatedReference método inicializa un existente EntityReference<TEntity> que se creó mediante el constructor sin parámetros. EntityReference<TEntity> se inicializa mediante la relación proporcionada y los nombres de rol de destino.

El InitializeRelatedReference método solo se usa durante la deserialización.

Se aplica a