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 執行大量作業

適用於