ObjectContext.Detach(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes the object from the object context.
public virtual void Detach (object entity);
abstract member Detach : obj -> unit
override this.Detach : obj -> unit
Public Overridable Sub Detach (entity As Object)
Parameters
- entity
- Object
Object to be detached. Only the entity is removed; if there are any related objects that are being tracked by the same ObjectStateManager , those will not be detached automatically.
Exceptions
The entity is null.
The entity is not associated with this ObjectContext (for example, was newly created and not associated with any context yet, or was obtained through some other context, or was already detached).
Applies to
Entity Framework