ObjectContext.DeleteObject Method (Object)
Marks an object for deletion.
Assembly: System.Data.Entity (in System.Data.Entity.dll)
Deleting the parent object also deletes all the child objects in the constrained relationship. This result is the same as enabling the CascadeDelete property on the association for the relationship.
Themethod can be called on objects that are already deleted.
These examples are based on the AdventureWorks Sales Model.
This example constructs an EntityKey with a specific ProductID, uses the key to retrieve a Product object from the data source, deletes the product, and saves the changes to the database.
This example deletes an existing order item, adds a new item, and saves the changes to the database.
Available since 3.5