diff --git a/src/FlexLabs.EntityFrameworkCore.Upsert/Runners/MySqlUpsertCommandRunner.cs b/src/FlexLabs.EntityFrameworkCore.Upsert/Runners/MySqlUpsertCommandRunner.cs index bf3ca56..557d5fc 100644 --- a/src/FlexLabs.EntityFrameworkCore.Upsert/Runners/MySqlUpsertCommandRunner.cs +++ b/src/FlexLabs.EntityFrameworkCore.Upsert/Runners/MySqlUpsertCommandRunner.cs @@ -38,13 +38,9 @@ public override string GenerateCommand(string tableName, ICollection - { - var statement = $"{EscapeName(e.ColumnName)} = {ExpandValue(e.Value)}"; - if (updateCondition != null) - statement = $"IF ({ExpandExpression(updateCondition)}, {statement}, {EscapeName(e.ColumnName)})"; - return statement; - }))); + .Select((e, i) => updateCondition != null + ? $"{EscapeName(e.ColumnName)} = IF ({ExpandExpression(updateCondition)}, {ExpandValue(e.Value)}, {EscapeName(e.ColumnName)})" + : $"{EscapeName(e.ColumnName)} = {ExpandValue(e.Value)}"))); } return result.ToString(); }