Table<TEntity>.DeleteAllOnSubmit<TSubEntity> Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Puts all entities from the collection into a pending delete
state.
public:
generic <typename TSubEntity>
where TSubEntity : TEntity void DeleteAllOnSubmit(System::Collections::Generic::IEnumerable<TSubEntity> ^ entities);
public void DeleteAllOnSubmit<TSubEntity> (System.Collections.Generic.IEnumerable<TSubEntity> entities) where TSubEntity : TEntity;
member this.DeleteAllOnSubmit : seq<#'Entity> -> unit
Public Sub DeleteAllOnSubmit(Of TSubEntity As TEntity) (entities As IEnumerable(Of TSubEntity))
- TSubEntity
The type of the elements to delete.
- entities
- IEnumerable<TSubEntity>
The entities to delete.
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();
Dim customersWithoutOrders As IEnumerable(Of Customer) = (From c In db.Customers _
Where c.Orders.Count = 0 _
Select c).ToList()
db.Customers.DeleteAllOnSubmit(customersWithoutOrders)
db.SubmitChanges()
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).
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 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: