ObjectContext.Attach Method (IEntityWithKey)

 

Attaches an object or object graph to the object context when the object has an entity key.

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

public virtual void Attach(
	IEntityWithKey entity
)

Parameters

entity
Type: System.Data.Entity.Core.Objects.DataClasses.IEntityWithKey

The object to attach.

Exception Condition
ArgumentNullException

The entity is null.

InvalidOperationException

Invalid entity key.