ObjectContext.Detach Method (Object)
Removes the object from the object context.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
After themethod is called, the system will no longer keep references that point to this object and it can be collected by the garbage collector.
Garbage collection can only occur if the user code does not have any references to the detached object.
The following considerations apply when detaching objects:
only affects the specific object that is passed to the method. If the object being detached has related objects in the object context, those objects are not detached.
Detaching objects does not affect data in the data source.
Cascade delete directives and referential constraints are not enforced during a detach operation.
For more information, see Attaching and Detaching Objects.
Available since 3.5