Skip to content

Commit 0fb040c

Browse files
nikitamKirillKurdyukov
authored andcommitted
fix lint
1 parent 066d1db commit 0fb040c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/EFCore.Ydb/src/Query/Internal/YdbSqlExpressionFactory.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.EntityFrameworkCore.Query;
66
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
77
using Microsoft.EntityFrameworkCore.Storage;
8+
89
namespace EntityFrameworkCore.Ydb.Query.Internal;
910

1011
public class YdbSqlExpressionFactory(SqlExpressionFactoryDependencies dependencies) : SqlExpressionFactory(dependencies)
@@ -18,8 +19,8 @@ public override SqlExpression Coalesce(SqlExpression left, SqlExpression right,
1819
{
1920
// For .Sum(x => x.Decimal) EF generates coalesce(sum(x.Decimal), 0.0)) because SUM must have value
2021

21-
if (left is SqlFunctionExpression funcExpression
22-
&&
22+
if (left is SqlFunctionExpression funcExpression
23+
&&
2324
right is SqlConstantExpression constExpression && constExpression.TypeMapping != null
2425
&&
2526
funcExpression.Name.Equals("SUM", StringComparison.OrdinalIgnoreCase)
@@ -34,11 +35,11 @@ public override SqlExpression Coalesce(SqlExpression left, SqlExpression right,
3435
var columnExpression = funcExpression.Arguments[0] as ColumnExpression;
3536

3637
var correctRight = new SqlConstantExpression(constExpression.Value,
37-
YdbDecimalTypeMapping.GetWithMaxPrecision(columnExpression?.TypeMapping?.Scale));
38+
YdbDecimalTypeMapping.GetWithMaxPrecision(columnExpression?.TypeMapping?.Scale));
3839

3940
return base.Coalesce(left, correctRight, typeMapping);
4041
}
41-
42+
4243
return base.Coalesce(left, right, typeMapping);
4344
}
4445
}

src/EFCore.Ydb/src/Storage/Internal/Mapping/YdbDecimalTypeMapping.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class YdbDecimalTypeMapping : DecimalTypeMapping
77
{
88
private const byte DefaultPrecision = 22;
99
private const byte DefaultScale = 9;
10-
10+
1111
private const byte MaxPrecision = 35;
1212

1313
public new static YdbDecimalTypeMapping Default => new();
@@ -54,5 +54,6 @@ protected override void ConfigureParameter(DbParameter parameter)
5454
parameter.Scale = (byte)s;
5555
}
5656

57-
protected override string GenerateNonNullSqlLiteral(object value) => $"Decimal('{base.GenerateNonNullSqlLiteral(value)}', {this.Precision ?? MaxPrecision}, {this.Scale ?? DefaultScale})";
57+
protected override string GenerateNonNullSqlLiteral(object value) =>
58+
$"Decimal('{base.GenerateNonNullSqlLiteral(value)}', {Precision ?? DefaultScale}, {Scale ?? DefaultScale})";
5859
}

0 commit comments

Comments
 (0)