Compartilhar via


EntityFrameworkQueryableExtensions.ExecuteDelete<TSource> Method

Definition

Deletes all database rows for the entity instances which match the LINQ query from the database.

public static int ExecuteDelete<TSource> (this System.Linq.IQueryable<TSource> source);
static member ExecuteDelete : System.Linq.IQueryable<'Source> -> int
<Extension()>
Public Function ExecuteDelete(Of TSource) (source As IQueryable(Of TSource)) As Integer

Type Parameters

TSource

Parameters

source
IQueryable<TSource>

The source query.

Returns

The total number of rows deleted in the database.

Remarks

This operation executes immediately against the database, rather than being deferred until SaveChanges() is called. It also does not interact with the EF change tracker in any way: entity instances which happen to be tracked when this operation is invoked aren't taken into account, and aren't updated to reflect the changes.

See Executing bulk operations with EF Core for more information and examples.

Applies to