Table<TEntity>.DeleteAllOnSubmit<TSubEntity> Method
Definition
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))
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();
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()
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
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om