Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Version.Details.props" />

<PropertyGroup Label="Version settings">
<VersionPrefix>10.0.2</VersionPrefix>
<VersionPrefix>10.0.3</VersionPrefix>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert, we handle version bumps separately.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was caused by the base branch change. Please rebase on main

<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<PreReleaseVersionIteration></PreReleaseVersionIteration>
<!-- Allowed values: '', 'prerelease', 'release'. Set to 'release' when stabilizing. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Globalization;
using System.Text.RegularExpressions;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore.Sqlite.Infrastructure.Internal;
Expand Down Expand Up @@ -186,7 +187,9 @@ private void InitializeDbConnection(DbConnection connection)

sqliteConnection.CreateCollation(
"EF_DECIMAL",
(x, y) => decimal.Compare(decimal.Parse(x), decimal.Parse(y)));
(x, y) => decimal.Compare(
decimal.Parse(x, NumberStyles.Number, CultureInfo.InvariantCulture),
decimal.Parse(y, NumberStyles.Number, CultureInfo.InvariantCulture)));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Text.RegularExpressions;
using Microsoft.EntityFrameworkCore.Sqlite.Internal;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;

// ReSharper disable InconsistentNaming
// ReSharper disable ParameterOnlyUsedForPreconditionCheck.Local
Expand Down Expand Up @@ -1544,6 +1545,76 @@ LIMIT 1
Assert.Equal(expectedResults, results);
}

[ConditionalFact, UseCulture("tr-TR")]
public virtual void Can_query_OrderBy_decimal_with_Turkish_culture()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please reduce this test to the bare minimum, removing all the unneeded stuff? Check out the minimal repro posted here.

{
using var context = CreateContext();
var min = new BuiltInDataTypes
{
Id = 225,
PartitionId = 209,
TestDecimal = 1.05m,
TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 12, 0, 0, TimeSpan.Zero),
TestTimeSpan = TimeSpan.FromDays(1),
TestUnsignedInt64 = 0
};
context.Add(min);

var middle = new BuiltInDataTypes
{
Id = 226,
PartitionId = 209,
TestDecimal = 1.5m,
TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 12, 0, 0, TimeSpan.Zero),
TestTimeSpan = TimeSpan.FromDays(2),
TestUnsignedInt64 = 1
};
context.Add(middle);

var max = new BuiltInDataTypes
{
Id = 227,
PartitionId = 209,
TestDecimal = 2.5m,
TestDateTimeOffset = new DateTimeOffset(2018, 1, 1, 11, 0, 0, TimeSpan.FromHours(-2)),
TestTimeSpan = TimeSpan.FromDays(10),
TestUnsignedInt64 = long.MaxValue + 1ul
};
context.Add(max);

context.SaveChanges();

Fixture.TestSqlLoggerFactory.Clear();

var query = context.Set<BuiltInDataTypes>()
.Where(e => e.PartitionId == 209);

var results = query
.OrderBy(e => e.TestDecimal)
.Select(e => new { e.Id, e.TestDecimal })
.ToList();

AssertSql(
"""
SELECT "b"."Id", "b"."TestDecimal"
FROM "BuiltInDataTypes" AS "b"
WHERE "b"."PartitionId" = 209
ORDER BY "b"."TestDecimal" COLLATE EF_DECIMAL
""");

var expectedResults = query.AsEnumerable()
.OrderBy(e => e.TestDecimal)
.Select(e => new { e.Id, e.TestDecimal })
.ToList();

Assert.Equal(expectedResults.Count, results.Count);
for (var i = 0; i < expectedResults.Count; i++)
{
Assert.Equal(expectedResults[i].Id, results[i].Id);
Assert.Equal(expectedResults[i].TestDecimal, results[i].TestDecimal);
}
}

[ConditionalFact]
public virtual void Can_query_using_char_ToLower()
{
Expand Down
Loading