語言

RelationalQueryableExtensions.ExecuteUpdate<TSource> 方法

定義

更新所有與資料庫 LINQ 查詢相符實體實例的資料庫資料列。

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

類型參數

TSource

參數

source
IQueryable<TSource>

來源查詢。

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

一組指定要更新屬性的集合屬性陳述。

傳回

資料庫中更新的總列數。

備註

此操作會立即對資料庫執行,而非延遲直到 SaveChanges() 被呼叫。 它也不會以任何方式與 EF 變更追蹤器互動:當此操作被追蹤的實體實例不會被考慮,且不會更新以反映變更。

更多資訊與範例請參見「 使用 EF Core 執行批量操作 」。

適用於