Compartir vía


RelationshipManager.InitializeRelatedReference<TTargetEntity> Método

Definición

Inicializa un elemento EntityReference<TEntity> existente que se ha creado con 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 objeto EntityReference<TEntity> que se va a inicializar.

Parámetros

relationshipName
String

Nombre de la relación.

targetRoleName
String

Nombre de la función del extremo relacionado.

entityReference
EntityReference<TTargetEntity>

EntityReference<TEntity> que se va a inicializar.

Atributos

Excepciones

Si la EntityReference<TEntity> proporcionada ya está inicializada.

o bien

Si el administrador de relaciones ya está asociado a un ObjectContext.

o bien

Si el administrador de relaciones ya contiene una relación con este nombre y esta función de destino.

Comentarios

El InitializeRelatedReference método inicializa un existente EntityReference<TEntity> que se creó mediante el constructor sin parámetros. La EntityReference<TEntity> se inicializa mediante el nombre de la relación y el nombre de la función de destino especificados.

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

Se aplica a