diff --git a/src/server/data/DbUpdateBuilder.cs b/src/server/data/DbUpdateBuilder.cs index 043ba32..73a05cc 100644 --- a/src/server/data/DbUpdateBuilder.cs +++ b/src/server/data/DbUpdateBuilder.cs @@ -14,6 +14,7 @@ public static DbUpdateBuilder Create(IQueryable query) public class DbUpdateBuilder(IQueryable query) { + private bool _hasSetPropertyCalls = false; private Expression, SetPropertyCalls>> _expression = sett => sett; public DbUpdateBuilder With( @@ -25,11 +26,12 @@ Expression, SetPropertyCalls>> setter Expression.Call(_expression.Body, call.Method, call.Arguments), _expression.Parameters ); + _hasSetPropertyCalls = true; return this; } public async Task ExecuteAsync(CancellationToken cancellation = default) { - return await query.ExecuteUpdateAsync(_expression, cancellation); + return _hasSetPropertyCalls ? await query.ExecuteUpdateAsync(_expression, cancellation) : 0; } }