Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to EF Core 9.0.0 #1948

Merged
merged 19 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
fail-fast: false
matrix:
dbVersion:
- 8.0.36-mysql
- 11.2.2-mariadb
- 11.1.3-mariadb
- 11.0.4-mariadb
- 10.11.6-mariadb
- 10.10.7-mariadb
- 10.6.16-mariadb
- 10.5.23-mariadb
- 10.4.32-mariadb
- 8.4.3-mysql
- 8.0.40-mysql
- 11.6.2-mariadb
- 11.5.2-mariadb
- 11.4.4-mariadb
- 11.3.2-mariadb
- 10.11.10-mariadb
- 10.6.20-mariadb
- 10.5.27-mariadb
os:
- ubuntu-latest
- windows-latest
Expand Down
62 changes: 33 additions & 29 deletions Dependencies.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Common Versions">
<EFCoreVersion>[9.0.0-preview.1.24081.2,9.0.0-preview.1.999999]</EFCoreVersion>
<EFCoreVersion>[9.0.0,9.0.999]</EFCoreVersion>
</PropertyGroup>

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

<PackageReference Update="MySqlConnector" Version="2.3.5" />
<PackageReference Update="MySqlConnector.DependencyInjection" Version="2.3.5" />
<PackageReference Update="MySqlConnector" Version="2.4.0" />
<PackageReference Update="MySqlConnector.DependencyInjection" Version="2.4.0" />

<PackageReference Update="NetTopologySuite" Version="2.5.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,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="[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.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.0" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<!--<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />-->
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="9.0.0" /> <!-- CHECK: used? -->
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="9.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Moq" Version="4.20.70" />
<PackageReference Update="System.Collections.Immutable" Version="[9.0.0-preview.1.24080.9,9.0.0-preview.1.999999]" />
<PackageReference Update="Moq" Version="4.20.72" />
<PackageReference Update="System.Collections.Immutable" Version="9.0.0" />
<PackageReference Update="System.ComponentModel.TypeConverter" Version="4.3.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="System.Diagnostics.DiagnosticSource" Version="9.0.0" />
<PackageReference Update="GitHubActionsTestLogger" Version="2.4.1" />
<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.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="xunit.assert" Version="2.9.2" />
<PackageReference Update="xunit.core" Version="2.9.2" />
<PackageReference Update="xunit.runner.console" Version="2.9.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.2" />
<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" />
<PackageReference Update="Microsoft.CodeAnalysis.Features" Version="4.5.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Features" Version="4.5.0" />
<PackageReference Update="Microsoft.CodeAnalysis.VisualBasic.Features" Version="4.5.0" />

<!-- Needed when using EFCore.Design assembly from local EF Core repository. -->
<PackageReference Update="Microsoft.CodeAnalysis" Version="4.10.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Features" Version="4.10.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageReference Update="Microsoft.CodeAnalysis.VisualBasic.Features" Version="4.10.0" />
<PackageReference Update="System.Text.Json" Version="9.0.0" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

<PropertyGroup>
<PomeloTargetFramework>net8.0</PomeloTargetFramework>
<PomeloTestTargetFramework>net8.0</PomeloTestTargetFramework>
<PomeloTestTargetFramework>net9.0</PomeloTestTargetFramework>
<EfCoreTargetFramework>net8.0</EfCoreTargetFramework>
<EfCoreTestTargetFramework>net8.0</EfCoreTestTargetFramework>
<EfCoreTestTargetFramework>net9.0</EfCoreTestTargetFramework>
<MySqlConnectorTargetFramework>net8.0</MySqlConnectorTargetFramework>
<MySqlConnectorDependencyInjectionTargetFramework>net7.0</MySqlConnectorDependencyInjectionTargetFramework>
<MySqlConnectorDependencyInjectionTargetFramework>net8.0</MySqlConnectorDependencyInjectionTargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -39,7 +39,7 @@
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath=""/>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
- "servicing" - EF Core release independent, code quality production ready, mainly bugfixes
-->
<VersionPrefix>9.0.0</VersionPrefix>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>2</PreReleaseVersionIteration>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>

<!--
The following properties will automatically be set by CI builds when appropriate:
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": "9.0.0-preview.1.24081.2",
"version": "9.0.0",
"commands": [
"dotnet-ef"
]
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": "8.0.100",
"version": "9.0.100",
"allowPrerelease": false,
"rollForward": "latestFeature"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion src/EFCore.MySql.NTS/EFCore.MySql.NTS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Collections.Immutable" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public virtual SqlExpression Translate(SqlExpression instance, MemberInfo member
{
new CaseWhenClause(
_sqlExpressionFactory.IsNull(instance),
_sqlExpressionFactory.Constant(null, RelationalTypeMapping.NullMapping))
_sqlExpressionFactory.Constant(null, returnType, resultTypeMapping))
},
sqlExpression);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public virtual SqlExpression Translate(SqlExpression instance, MemberInfo member
{
new CaseWhenClause(
_sqlExpressionFactory.IsNull(instance),
_sqlExpressionFactory.Constant(null, RelationalTypeMapping.NullMapping))
_sqlExpressionFactory.Constant(null, returnType, resultTypeMapping))
},
sqlExpression);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public virtual SqlExpression Translate(SqlExpression instance, MemberInfo member
{
new CaseWhenClause(
_sqlExpressionFactory.IsNull(instance),
_sqlExpressionFactory.Constant(null, RelationalTypeMapping.NullMapping))
_sqlExpressionFactory.Constant(null, returnType))
},
sqlExpression);
}
Expand Down
3 changes: 2 additions & 1 deletion src/EFCore.MySql/EFCore.MySql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<AssemblyName>Pomelo.EntityFrameworkCore.MySql</AssemblyName>
<RootNamespace>Pomelo.EntityFrameworkCore.MySql</RootNamespace>
<PackageReadmeFile>README.md</PackageReadmeFile>
<NoWarn>$(NoWarn);EF9100</NoWarn> <!-- Precompiled query is experimental -->
<NoWarn>$(NoWarn);CS1591</NoWarn> <!-- TODO: Missing XML comment for publicly visible type or member 'Type_or_Member' -->
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -48,7 +50,6 @@
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
</ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion src/EFCore.MySql/Infrastructure/MariaDbServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public class MariaDbServerVersion : ServerVersion

public override ServerVersionSupport Supports { get; }

// MariaDB on Linux seems to be using uca1400 collations as the default for the utf8mb4 charset from 11.4.2 onwards, but MariaDB for
// Windows seems to be using it only in later minor versions.
public override string DefaultUtf8CsCollation => Version >= new Version(11, 4, 2) ? "utf8mb4_uca1400_as_cs" : "utf8mb4_bin";
public override string DefaultUtf8CiCollation => Version >= new Version(11, 4, 2) ? "utf8mb4_uca1400_ai_ci" : "utf8mb4_general_ci";

public MariaDbServerVersion(Version version)
: base(version, ServerType.MariaDb)
{
Expand Down Expand Up @@ -64,7 +69,7 @@ internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
public override bool GeneratedColumns => ServerVersion.Version >= new Version(10, 2, 0);
public override bool NullableGeneratedColumns => false;
public override bool ParenthesisEnclosedGeneratedColumnExpressions => false;
public override bool DefaultCharSetUtf8Mb4 => false;
public override bool DefaultCharSetUtf8Mb4 => ServerVersion.Version >= new Version(11, 4, 2);
public override bool DefaultExpression => false;
public override bool AlternativeDefaultExpression => ServerVersion.Version >= new Version(10, 2, 7);
public override bool SpatialIndexes => ServerVersion.Version >= new Version(10, 2, 2);
Expand All @@ -91,6 +96,8 @@ internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
public override bool Values => ServerVersion.Version >= new Version(10, 3, 3);
public override bool ValuesWithRows => false;
public override bool WhereSubqueryReferencesOuterQuery => false;
public override bool FieldReferenceInTableValueConstructor => false;
public override bool CollationCharacterSetApplicabilityWithFullCollationNameColumn => ServerVersion.Version >= new Version(10, 10, 1);

public override bool JsonTableImplementationStable => false;
public override bool JsonTableImplementationWithoutMariaDbBugs => false;
Expand Down
5 changes: 5 additions & 0 deletions src/EFCore.MySql/Infrastructure/MySqlServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class MySqlServerVersion : ServerVersion

public override ServerVersionSupport Supports { get; }

public override string DefaultUtf8CsCollation => Supports.DefaultCharSetUtf8Mb4 ? "utf8mb4_0900_as_cs" : "utf8mb4_bin";
public override string DefaultUtf8CiCollation => Supports.DefaultCharSetUtf8Mb4 ? "utf8mb4_0900_ai_ci" : "utf8mb4_general_ci";

public MySqlServerVersion(Version version)
: base(version, ServerType.MySql)
{
Expand Down Expand Up @@ -94,6 +97,8 @@ internal MySqlServerVersionSupport([NotNull] ServerVersion serverVersion)
public override bool Values => false;
public override bool ValuesWithRows => ServerVersion.Version >= new Version(8, 0, 19);
public override bool WhereSubqueryReferencesOuterQuery => false;
public override bool FieldReferenceInTableValueConstructor => true;
public override bool CollationCharacterSetApplicabilityWithFullCollationNameColumn => false;

public override bool JsonTableImplementationStable => false;
public override bool JsonTableImplementationWithoutMySqlBugs => false; // Other non-fatal bugs regarding JSON_TABLE.
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore.MySql/Infrastructure/ServerVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ protected ServerVersion(Version version, ServerType type, string typeIdentifier

public virtual int MaxKeyLength => Supports.LargerKeyLength ? 3072 : 767;
public virtual CharSet DefaultCharSet => Supports.DefaultCharSetUtf8Mb4 ? CharSet.Utf8Mb4 : CharSet.Latin1;
public virtual string DefaultUtf8CsCollation => Supports.DefaultCharSetUtf8Mb4 ? "utf8mb4_0900_as_cs" : "utf8mb4_bin";
public virtual string DefaultUtf8CiCollation => Supports.DefaultCharSetUtf8Mb4 ? "utf8mb4_0900_ai_ci" : "utf8mb4_general_ci";
public abstract string DefaultUtf8CsCollation { get; }
public abstract string DefaultUtf8CiCollation { get; }

public override bool Equals(object obj)
=> obj is ServerVersion version &&
Expand Down
2 changes: 2 additions & 0 deletions src/EFCore.MySql/Infrastructure/ServerVersionSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public virtual bool PropertyOrVersion(string propertyNameOrServerVersion)
public virtual bool Values => false;
public virtual bool ValuesWithRows => false;
public virtual bool WhereSubqueryReferencesOuterQuery => false;
public virtual bool FieldReferenceInTableValueConstructor => false;
public virtual bool CollationCharacterSetApplicabilityWithFullCollationNameColumn => false;

public virtual bool JsonTableImplementationStable => JsonTable;
public virtual bool JsonTableImplementationWithoutMySqlBugs => JsonTable;
Expand Down
Loading
Loading