Muokkaa

Jaa


RelatedEnd.Attach<TEntity>(IEnumerable<TEntity>, Boolean) Method

Definition

Defines a relationship between two attached objects.

protected public:
generic <typename TEntity>
 void Attach(System::Collections::Generic::IEnumerable<TEntity> ^ entities, bool allowCollection);
protected internal void Attach<TEntity> (System.Collections.Generic.IEnumerable<TEntity> entities, bool allowCollection);
member this.Attach : seq<'Entity> * bool -> unit
Protected Friend Sub Attach(Of TEntity) (entities As IEnumerable(Of TEntity), allowCollection As Boolean)

Type Parameters

TEntity

The type of the IEnumerable<T> collection of entity objects to attach.

Parameters

entities
IEnumerable<TEntity>

An IEnumerable<T> collection of entity objects.

allowCollection
Boolean

Specifies whether the object being attached is part of a collection.

Remarks

The Attach<TEntity>(IEnumerable<TEntity>, Boolean) method is used to define a relationship between an object and a related object when both objects are already attached to an object context. Set the related object to the Value property of the EntityReference<TEntity> or call the Add method on the EntityCollection<TEntity> if the related object is not already attached to the object context. When both objects are detached, you can also define the relationship by setting the related object to the Value property of the EntityReference<TEntity> or by calling the Add method on the EntityCollection<TEntity> and then attaching the root object in the object graph. For more information, see Attaching and Detaching Objects.

The Attach<TEntity>(IEnumerable<TEntity>, Boolean) method is called by Object Services during attach operations against a related end.

Applies to