Skip to content

Commit

Permalink
fix: internal server error when sending already existing push sub (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaSch0212 authored Jul 6, 2024
1 parent f1d5425 commit 92934ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/data/DbUpdateBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static DbUpdateBuilder<T> Create<T>(IQueryable<T> query)

public class DbUpdateBuilder<T>(IQueryable<T> query)
{
private bool _hasSetPropertyCalls = false;
private Expression<Func<SetPropertyCalls<T>, SetPropertyCalls<T>>> _expression = sett => sett;

public DbUpdateBuilder<T> With(
Expand All @@ -25,11 +26,12 @@ Expression<Func<SetPropertyCalls<T>, SetPropertyCalls<T>>> setter
Expression.Call(_expression.Body, call.Method, call.Arguments),
_expression.Parameters
);
_hasSetPropertyCalls = true;
return this;
}

public async Task<int> ExecuteAsync(CancellationToken cancellation = default)
{
return await query.ExecuteUpdateAsync(_expression, cancellation);
return _hasSetPropertyCalls ? await query.ExecuteUpdateAsync(_expression, cancellation) : 0;
}
}

0 comments on commit 92934ec

Please sign in to comment.