Skip to content

Commit

Permalink
Upgrade to EF Core 9.0.0-preview.1 (#1853)
Browse files Browse the repository at this point in the history
* Update branding to 9.0.0-preview.1.

* Update dependencies.

* Update project files.

* Update EFCore.MySql.

* Update EFCore.MySql.FunctionalTests.

* Update MySQL version used in CI.

* Remove special case for MySqlBug96947Workaround from tests.

* Explicitly throw exception if primitive collection support has not been enabled, to ensure the error message is not lost along the way.

* Update test baselines.

* Add new test classes.

* Fix new tests.

* Add CompiledModelMySqlTest scaffolding baselines.

* Fix test baselines for MariaDB.
  • Loading branch information
lauxjpn authored Feb 28, 2024
1 parent 40ed6d9 commit f5f7a56
Show file tree
Hide file tree
Showing 115 changed files with 30,796 additions and 6,998 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
fail-fast: false
matrix:
dbVersion:
- 8.0.34-mysql
- 5.7.43-mysql
- 8.0.36-mysql
- 11.2.2-mariadb
- 11.1.3-mariadb
- 11.0.4-mariadb
Expand Down
41 changes: 21 additions & 20 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.1,8.0.999]</EFCoreVersion>
<EFCoreVersion>[9.0.0-preview.1.24081.2,9.0.0-preview.1.999999]</EFCoreVersion>
</PropertyGroup>

<ItemGroup Label="Dependencies">
Expand All @@ -13,36 +13,37 @@
<PackageReference Update="MySqlConnector.DependencyInjection" Version="2.3.5" />

<PackageReference Update="NetTopologySuite" Version="2.5.0" />
<PackageReference Update="System.Text.Json" Version="8.0.1" />
<PackageReference Update="System.Text.Json" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<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.1" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.1" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Update="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="[8.0.0,8.0.999]" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="[8.0.0,8.0.999]" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<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.Extensions.Caching.Memory" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" /> <!-- CHECK: used? -->
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Moq" Version="4.20.70" />
<PackageReference Update="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Update="System.Collections.Immutable" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="8.0.0" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Update="Xunit.SkippableFact" Version="1.4.13" />

<!-- Keep at the same level that the EF Core projects use. -->
<PackageReference Update="xunit.assert" Version="2.4.2" />
<PackageReference Update="xunit.core" Version="2.4.2" />
<PackageReference Update="xunit.runner.console" Version="2.4.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.2" />
<PackageReference Update="xunit.assert" Version="2.6.1" />
<PackageReference Update="xunit.core" Version="2.6.1" />
<PackageReference Update="xunit.runner.console" Version="2.6.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Update="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<PackageReference Update="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Update="Microsoft.CodeAnalysis" Version="4.5.0" />
Expand Down
4 changes: 2 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<add key="pomelo-nightly-public-myget" value="https://www.myget.org/F/pomelo/api/v3/index.json" />
<add key="pomelo-nightly-debug-myget" value="https://www.myget.org/F/pomelo-debug/api/v3/index.json" />

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />

<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
4 changes: 2 additions & 2 deletions Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
- "rtm" - EF Core release independent, code quality production ready, major release
- "servicing" - EF Core release independent, code quality production ready, mainly bugfixes
-->
<VersionPrefix>8.0.1</VersionPrefix>
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<VersionPrefix>9.0.0</VersionPrefix>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>

<!--
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.1",
"version": "9.0.0-preview.1.24081.2",
"commands": [
"dotnet-ef"
]
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.MySql/Infrastructure/MariaDbServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
public override bool JsonValue => true;
public override bool Values => ServerVersion.Version >= new Version(10, 3, 3);
public override bool ValuesWithRows => false;
public override bool OffsetReferencesOuterQuery => false;
public override bool WhereSubqueryReferencesOuterQuery => false;

public override bool JsonTableImplementationStable => false;
public override bool JsonTableImplementationWithoutMariaDbBugs => false;
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ internal MySqlServerVersionSupport([NotNull] ServerVersion serverVersion)
public override bool JsonValue => ServerVersion.Version >= new Version(8, 0, 21);
public override bool Values => false;
public override bool ValuesWithRows => ServerVersion.Version >= new Version(8, 0, 19);
public override bool OffsetReferencesOuterQuery => false;
public override bool WhereSubqueryReferencesOuterQuery => false;

public override bool JsonTableImplementationStable => false;
public override bool JsonTableImplementationWithoutMySqlBugs => false; // Other non-fatal bugs regarding JSON_TABLE.
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.MySql/Infrastructure/ServerVersionSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public virtual bool PropertyOrVersion(string propertyNameOrServerVersion)
public virtual bool JsonValue => false;
public virtual bool Values => false;
public virtual bool ValuesWithRows => false;
public virtual bool OffsetReferencesOuterQuery => false;
public virtual bool WhereSubqueryReferencesOuterQuery => false;

public virtual bool JsonTableImplementationStable => JsonTable;
public virtual bool JsonTableImplementationWithoutMySqlBugs => JsonTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ protected static class InternalLocalAnnotationNames
public MySqlMigrationsModelDiffer(
IRelationalTypeMappingSource typeMappingSource,
IMigrationsAnnotationProvider migrationsAnnotationProvider,
IRelationalAnnotationProvider relationalAnnotationProvider,
IRowIdentityMapFactory rowIdentityMapFactory,
CommandBatchPreparerDependencies commandBatchPreparerDependencies)
: base(
typeMappingSource,
migrationsAnnotationProvider,
relationalAnnotationProvider,
rowIdentityMapFactory,
commandBatchPreparerDependencies)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Pomelo.EntityFrameworkCore.MySql.Query.ExpressionTranslators.Internal;
/// <summary>
/// An expression that represents a MySQL JSON_TABLE() function call in a SQL tree.
/// </summary>
public class MySqlJsonTableExpression : TableValuedFunctionExpression, IClonableTableExpressionBase
public class MySqlJsonTableExpression : TableValuedFunctionExpression
{
/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
Expand Down Expand Up @@ -134,26 +134,6 @@ public virtual MySqlJsonTableExpression Update(
? this
: new MySqlJsonTableExpression(Alias, jsonExpression, path, columnInfos);


/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
// TODO: Deep clone, see #30982
public virtual TableExpressionBase Clone()
{
var clone = new MySqlJsonTableExpression(Alias, JsonExpression, Path, ColumnInfos);

foreach (var annotation in GetAnnotations())
{
clone.AddAnnotation(annotation.Name, annotation.Value);
}

return clone;
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
Expand Down Expand Up @@ -517,7 +518,8 @@ private SqlExpression MakeContainsExpressionImpl(
_sqlExpressionFactory.Constant(string.Empty, stringTypeMapping)))));
}

protected virtual SqlExpression GetLikeExpressionUsingParameter(QueryCompilationContext queryCompilationContext,
protected virtual SqlExpression GetLikeExpressionUsingParameter(
QueryCompilationContext queryCompilationContext,
SqlExpression target,
Func<SqlExpression, SqlExpression> targetTransform,
SqlExpression pattern,
Expand All @@ -538,7 +540,9 @@ protected virtual SqlExpression GetLikeExpressionUsingParameter(QueryCompilation
QueryCompilationContext.QueryContextParameter);

var escapedPatternParameter =
queryCompilationContext.RegisterRuntimeParameter(patternParameter.Name + "_rewritten", lambda);
queryCompilationContext.RegisterRuntimeParameter(
$"{patternParameter.Name}_{methodType.ToString().ToLower(CultureInfo.InvariantCulture)}",
lambda);

return _sqlExpressionFactory.Like(
targetTransform(target),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected override Expression VisitColumn(ColumnExpression columnExpression)
}

protected override Expression VisitDelete(DeleteExpression deleteExpression)
=> deleteExpression.Update((SelectExpression)Visit(deleteExpression.SelectExpression));
=> deleteExpression.Update(deleteExpression.Table, (SelectExpression)Visit(deleteExpression.SelectExpression));

protected override Expression VisitDistinct(DistinctExpression distinctExpression)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MySqlQueryTranslationPostprocessor : RelationalQueryTranslationPost
public MySqlQueryTranslationPostprocessor(
QueryTranslationPostprocessorDependencies dependencies,
RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
QueryCompilationContext queryCompilationContext,
MySqlQueryCompilationContext queryCompilationContext,
IMySqlOptions options,
MySqlSqlExpressionFactory sqlExpressionFactory)
: base(dependencies, relationalDependencies, queryCompilationContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public virtual QueryTranslationPostprocessor Create(QueryCompilationContext quer
=> new MySqlQueryTranslationPostprocessor(
_dependencies,
_relationalDependencies,
queryCompilationContext,
(MySqlQueryCompilationContext)queryCompilationContext,
_options,
_sqlExpressionFactory);
}
Expand Down
Loading

0 comments on commit f5f7a56

Please sign in to comment.