From 5b5ad1b6d1499d1c994efeb7516d79094c2cbeb2 Mon Sep 17 00:00:00 2001 From: Marc Schmidt Date: Sat, 6 Jul 2024 22:57:08 +0200 Subject: [PATCH] fix: internal server error when sending already existing push sub --- src/server/data/DbUpdateBuilder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } }