Share via


ObjectContext.Attach(IEntityWithKey) Method

Definition

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

public virtual void Attach (System.Data.Entity.Core.Objects.DataClasses.IEntityWithKey entity);
abstract member Attach : System.Data.Entity.Core.Objects.DataClasses.IEntityWithKey -> unit
override this.Attach : System.Data.Entity.Core.Objects.DataClasses.IEntityWithKey -> unit
Public Overridable Sub Attach (entity As IEntityWithKey)

Parameters

entity
IEntityWithKey

The object to attach.

Exceptions

The entity is null.

Invalid entity key.

Applies to