Table<TEntity>.DeleteAllOnSubmit<TSubEntity> Method

Definition

Puts all entities from the collection into a pending delete state.

public void DeleteAllOnSubmit<TSubEntity> (System.Collections.Generic.IEnumerable<TSubEntity> entities) where TSubEntity : TEntity;

Type Parameters

TSubEntity

The type of the elements to delete.

Parameters

entities
IEnumerable<TSubEntity>

The entities to delete.

Examples

The following example shows one use for this method:

IEnumerable<Customer> customersWithoutOrders = (from c in db.Customers  
   where c.Orders.Count == 0  
   select c).ToList();  

db.Customers.DeleteAllOnSubmit(customersWithoutOrders);  
db.SubmitChanges();  

Remarks

Entities that are put into the pending delete state with this method do not disappear from query results until after SubmitChanges is called. Disconnected entities must be attached before they can be deleted. For more information, see Data Retrieval and CUD Operations in N-Tier Applications (LINQ to SQL).

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1