Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

RelationalQueryableExtensions.ExecuteDelete<TSource> Method

Definition

Namespace:
Microsoft.EntityFrameworkCore
Assembly:
Microsoft.EntityFrameworkCore.Relational.dll
Package:
Microsoft.EntityFrameworkCore.Relational v7.0.0
Package:
Microsoft.EntityFrameworkCore.Relational v8.0.0
Source:
RelationalQueryableExtensions.cs
Source:
RelationalQueryableExtensions.cs

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.

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


Feedback

Was this page helpful?