Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DbSet.Remove Method (Object)


Marks the given entity as Deleted such that it will be deleted from the database when SaveChanges is called. Note that the entity must exist in the context in some other state before this method is called.

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

Public Overridable Function Remove (
	entity As Object
) As Object


Type: System.Object

The entity to remove.

Return Value

Type: System.Object

The entity.

Note that if the entity exists in the context in the Added state, then this method will cause it to be detached from the context. This is because an Added entity is assumed not to exist in the database such that trying to delete it does not make sense.

Return to top
© 2015 Microsoft