Context. Detach(Object) Method
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)
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.
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).