Compartilhar via


EntityFrameworkQueryableExtensions.ExecuteUpdate<TSource> Method

Definition

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

public static int ExecuteUpdate<TSource> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<Microsoft.EntityFrameworkCore.Query.SetPropertyCalls<TSource>,Microsoft.EntityFrameworkCore.Query.SetPropertyCalls<TSource>>> setPropertyCalls);
static member ExecuteUpdate : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<Microsoft.EntityFrameworkCore.Query.SetPropertyCalls<'Source>, Microsoft.EntityFrameworkCore.Query.SetPropertyCalls<'Source>>> -> int
<Extension()>
Public Function ExecuteUpdate(Of TSource) (source As IQueryable(Of TSource), setPropertyCalls As Expression(Of Func(Of SetPropertyCalls(Of TSource), SetPropertyCalls(Of TSource)))) As Integer

Type Parameters

TSource

Parameters

source
IQueryable<TSource>

The source query.

setPropertyCalls
Expression<Func<SetPropertyCalls<TSource>,SetPropertyCalls<TSource>>>

A collection of set property statements specifying properties to update.

Returns

The total number of rows updated 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