IRelatedEnd.Attach Method (IEntityWithRelationships)

 

Defines a relationship between two attached objects.

Namespace:   System.Data.Objects.DataClasses
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

void Attach(
	IEntityWithRelationships entity
)

Parameters

entity
Type: System.Data.Objects.DataClasses.IEntityWithRelationships

The object being attached. entity must implement IEntityWithRelationships.

The Attach method is used to define a relationship between two objects that are both attached to the same ObjectContext instance.

The RelatedEnd class explicitly implements the Attach method. The EntityCollection<TEntity> class uses this implementation to define relationships between the attached source object and the object attached to the collection. For more information, see Attaching and Detaching Objects.

.NET Framework
Available since 3.5
Return to top
Show: