Skip to content

Commit

Permalink
Sync to EF 10.0.0-preview.2.25103.6 (#3454)
Browse files Browse the repository at this point in the history
  • Loading branch information
roji authored Feb 4, 2025
1 parent 352306a commit 85cd0aa
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
pull_request:

env:
dotnet_sdk_version: '10.0.100-alpha.1.25059.31'
dotnet_sdk_version: '10.0.100-preview.2.25081.1'
postgis_version: 3
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
- cron: '30 22 * * 6'

env:
dotnet_sdk_version: '10.0.100-alpha.1.25059.31'
dotnet_sdk_version: '10.0.100-preview.2.25081.1'

jobs:
analyze:
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<EFCoreVersion>10.0.0-preview.1.25077.1</EFCoreVersion>
<MicrosoftExtensionsVersion>10.0.0-alpha.1.25073.13</MicrosoftExtensionsVersion>
<EFCoreVersion>10.0.0-preview.2.25103.6</EFCoreVersion>
<MicrosoftExtensionsVersion>10.0.0-preview.2.25102.2</MicrosoftExtensionsVersion>
<NpgsqlVersion>9.0.2</NpgsqlVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.100-alpha.1.25059.31",
"version": "10.0.100-preview.2.25081.1",
"rollForward": "latestMajor",
"allowPrerelease": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Microsoft.EntityFrameworkCore.BulkUpdates;

#nullable disable

public class NorthwindBulkUpdatesNpgsqlTest(
NorthwindBulkUpdatesNpgsqlFixture<NoopModelCustomizer> fixture,
ITestOutputHelper testOutputHelper)
Expand Down Expand Up @@ -619,6 +621,30 @@ LIMIT 100 OFFSET 0
""");
}

public override async Task Delete_with_RightJoin(bool async)
{
await base.Delete_with_RightJoin(async);

AssertSql(
"""
@p0='100'
@p='0'
DELETE FROM "Order Details" AS o
WHERE EXISTS (
SELECT 1
FROM "Order Details" AS o0
RIGHT JOIN (
SELECT o2."OrderID"
FROM "Orders" AS o2
WHERE o2."OrderID" < 10300
ORDER BY o2."OrderID" NULLS FIRST
LIMIT @p0 OFFSET @p
) AS o1 ON o0."OrderID" = o1."OrderID"
WHERE o0."OrderID" < 10276 AND o0."OrderID" = o."OrderID" AND o0."ProductID" = o."ProductID")
""");
}

public override async Task Update_Where_set_constant_TagWith(bool async)
{
await base.Update_Where_set_constant_TagWith(async);
Expand Down Expand Up @@ -1287,6 +1313,41 @@ WHERE c."CustomerID" LIKE 'F%'
""");
}

public override async Task Update_with_RightJoin(bool async)
{
await AssertUpdate(
async,
ss => ss.Set<Order>().Where(o => o.OrderID < 10300)
.RightJoin(
ss.Set<Customer>().Where(c => c.CustomerID.StartsWith("F")),
o => o.CustomerID,
c => c.CustomerID,
(o, c) => new { Order = o, Customers = c }),
e => e.Order,
s => s.SetProperty(t => t.Order.OrderDate, new DateTime(2020, 1, 1, 0, 0, 0)),
rowsAffectedCount: 2,
(b, a) => Assert.All(a, o => Assert.Equal(new DateTime(2020, 1, 1, 0, 0, 0), o.OrderDate)));

AssertExecuteUpdateSql(
"""
@p='2020-01-01T00:00:00.0000000' (Nullable = true)
UPDATE "Orders" AS o0
SET "OrderDate" = @p
FROM (
SELECT o."OrderID"
FROM "Orders" AS o
RIGHT JOIN (
SELECT c."CustomerID"
FROM "Customers" AS c
WHERE c."CustomerID" LIKE 'F%'
) AS c0 ON o."CustomerID" = c0."CustomerID"
WHERE o."OrderID" < 10300
) AS s
WHERE o0."OrderID" = s."OrderID"
""");
}

public override async Task Update_with_cross_join_set_constant(bool async)
{
await base.Update_with_cross_join_set_constant(async);
Expand Down
16 changes: 14 additions & 2 deletions test/EFCore.PG.FunctionalTests/Query/JsonQueryNpgsqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,9 @@ public override async Task Project_entity_with_single_owned(bool async)
""");
}

public override async Task Left_join_json_entities(bool async)
public override async Task LeftJoin_json_entities(bool async)
{
await base.Left_join_json_entities(async);
await base.LeftJoin_json_entities(async);

AssertSql(
"""
Expand All @@ -618,6 +618,18 @@ public override async Task Left_join_json_entities(bool async)
""");
}

public override async Task RightJoin_json_entities(bool async)
{
await base.RightJoin_json_entities(async);

AssertSql(
"""
SELECT j."Id", j."EntityBasicId", j."Name", j."OwnedCollectionRoot", j."OwnedReferenceRoot", j0."Id", j0."Name", j0."OwnedCollection"
FROM "JsonEntitiesBasic" AS j
RIGHT JOIN "JsonEntitiesSingleOwned" AS j0 ON j."Id" = j0."Id"
""");
}

public override async Task Left_join_json_entities_complex_projection(bool async)
{
await base.Left_join_json_entities_complex_projection(async);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,39 @@ public override async Task Contains_with_local_uint_array_closure(bool async)
""");
}

public override async Task Contains_with_local_nullable_uint_array_closure(bool async)
{
await base.Contains_with_local_nullable_uint_array_closure(async);

// Note: PostgreSQL doesn't support uint, but value converters make this into bigint

AssertSql(
"""
@ids={ '0', '1' } (DbType = Object)
SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title"
FROM "Employees" AS e
WHERE e."EmployeeID" = ANY (@ids)
""",
//
"""
@ids={ '0' } (DbType = Object)
SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title"
FROM "Employees" AS e
WHERE e."EmployeeID" = ANY (@ids)
""");
}

public override Task Contains_with_local_anonymous_type_array_closure(bool async)
// Aggregates. Issue #15937.
=> AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(async));

public override Task Contains_with_local_tuple_array_closure(bool async)
=> Assert.ThrowsAsync<InvalidCastException>(() => base.Contains_with_local_tuple_array_closure(async: true));
// TODO: The base implementations no longer compile since https://github.com/dotnet/runtime/pull/110197 (Contains overload added with
// optional parameter, not supported in expression trees). #35547 is tracking on the EF side.
//
// public override async Task Contains_with_local_nullable_uint_array_closure(bool async)
// {
// await base.Contains_with_local_nullable_uint_array_closure(async);
//
// // Note: PostgreSQL doesn't support uint, but value converters make this into bigint
//
// AssertSql(
// """
// @ids={ '0', '1' } (DbType = Object)
//
// SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title"
// FROM "Employees" AS e
// WHERE e."EmployeeID" = ANY (@ids)
// """,
// //
// """
// @ids={ '0' } (DbType = Object)
//
// SELECT e."EmployeeID", e."City", e."Country", e."FirstName", e."ReportsTo", e."Title"
// FROM "Employees" AS e
// WHERE e."EmployeeID" = ANY (@ids)
// """);
// }
//
// public override Task Contains_with_local_anonymous_type_array_closure(bool async)
// // Aggregates. Issue #15937.
// => AssertTranslationFailed(() => base.Contains_with_local_anonymous_type_array_closure(async));
//
// public override Task Contains_with_local_tuple_array_closure(bool async)
// => Assert.ThrowsAsync<InvalidCastException>(() => base.Contains_with_local_tuple_array_closure(async: true));

public override async Task Contains_with_local_enumerable_inline(bool async)
{
Expand Down
Loading

0 comments on commit 85cd0aa

Please sign in to comment.