From 3949e67c47f71fe8326914eb597ada016f449cb0 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Mon, 20 Nov 2023 16:15:13 +0100 Subject: [PATCH] Add support for .NET 8 + Microsoft.EntityFrameworkCore 8 (#756) * Add .NET 8 * fix ci * readme --- .github/workflows/ci.yml | 18 +++--- README.md | 2 +- System.Linq.Dynamic.Core.sln | 38 +++++++++++++ ...tyFrameworkCore.DynamicLinq.EFCore8.csproj | 48 ++++++++++++++++ .../Properties/AssemblyInfo.cs | 6 ++ .../System.Linq.Dynamic.Core.csproj | 6 +- ...System.Linq.Dynamic.Core.Tests.Net6.csproj | 1 - ...System.Linq.Dynamic.Core.Tests.Net8.csproj | 57 +++++++++++++++++++ .../EntitiesTests.FormattableString.cs | 1 + .../EntitiesTests.TakeWhile.cs | 1 + .../Parser/StringParserTests.cs | 2 +- .../QueryableTests.Where.cs | 2 +- 12 files changed, 168 insertions(+), 14 deletions(-) create mode 100644 src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj create mode 100644 src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Properties/AssemblyInfo.cs create mode 100644 test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47d6cc38..c00b9b2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,22 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-dotnet@v1 + - uses: actions/setup-dotnet@v3 with: - dotnet-version: '6.0.x' - - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '7.0.x' - + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + - name: Build Projects run: | dotnet build ./src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj -c Release -p:buildType=azure-pipelines-ci + - name: Run Tests net8.0 + run: | + dotnet build ./test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj -c Release -p:buildType=azure-pipelines-ci + dotnet test ./test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj -c Release -p:buildType=azure-pipelines-ci --no-build + - name: Run Tests net7.0 run: | dotnet build ./test/System.Linq.Dynamic.Core.Tests.Net7/System.Linq.Dynamic.Core.Tests.Net7.csproj -c Release -p:buildType=azure-pipelines-ci diff --git a/README.md b/README.md index abe2b88d..6f04f55d 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ If it's not possible to add that attribute, you need to implement a custom [Cust The following frameworks are supported: - net35, net40, net45, net46 and up - netstandard1.3, netstandard2.0 and netstandard2.1 -- netcoreapp3.1, net5.0, net6.0 and net7.0 +- netcoreapp3.1, net5.0, net6.0, net7.0 and net8.0 - uap10.0 ### Fork details diff --git a/System.Linq.Dynamic.Core.sln b/System.Linq.Dynamic.Core.sln index 4c404474..0c684bf3 100644 --- a/System.Linq.Dynamic.Core.sln +++ b/System.Linq.Dynamic.Core.sln @@ -132,6 +132,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net7", "test\System.Linq.Dynamic.Core.Tests.Net7\System.Linq.Dynamic.Core.Tests.Net7.csproj", "{CC63ECEB-18C1-462B-BAFC-7F146A7C2740}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8", "src\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8\Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj", "{9000129D-322D-4FE6-9C47-75464577C374}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Linq.Dynamic.Core.Tests.Net8", "test\System.Linq.Dynamic.Core.Tests.Net8\System.Linq.Dynamic.Core.Tests.Net8.csproj", "{ABB1BF71-8927-49BB-99F3-70BCB2CD161E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -802,6 +806,38 @@ Global {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x64.Build.0 = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x86.ActiveCfg = Release|Any CPU {CC63ECEB-18C1-462B-BAFC-7F146A7C2740}.Release|x86.Build.0 = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|ARM.ActiveCfg = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|ARM.Build.0 = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x64.ActiveCfg = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x64.Build.0 = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x86.ActiveCfg = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Debug|x86.Build.0 = Debug|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|Any CPU.Build.0 = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|ARM.ActiveCfg = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|ARM.Build.0 = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|x64.ActiveCfg = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|x64.Build.0 = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.ActiveCfg = Release|Any CPU + {9000129D-322D-4FE6-9C47-75464577C374}.Release|x86.Build.0 = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|ARM.ActiveCfg = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|ARM.Build.0 = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x64.ActiveCfg = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x64.Build.0 = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x86.ActiveCfg = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Debug|x86.Build.0 = Debug|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|Any CPU.Build.0 = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|ARM.ActiveCfg = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|ARM.Build.0 = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x64.ActiveCfg = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x64.Build.0 = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x86.ActiveCfg = Release|Any CPU + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -848,6 +884,8 @@ Global {B133DA55-339D-4600-AED3-46214AD9F08A} = {122BC4FA-7563-4E35-9D17-077F16F1629F} {FB2F4C99-EC34-4D29-87E2-944B25D90EF7} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} {CC63ECEB-18C1-462B-BAFC-7F146A7C2740} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} + {9000129D-322D-4FE6-9C47-75464577C374} = {DBD7D9B6-FCC7-4650-91AF-E6457573A68F} + {ABB1BF71-8927-49BB-99F3-70BCB2CD161E} = {8463ED7E-69FB-49AE-85CF-0791AFD98E38} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {94C56722-194E-4B8B-BC23-B3F754E89A20} diff --git a/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj b/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj new file mode 100644 index 00000000..a380c22c --- /dev/null +++ b/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8.csproj @@ -0,0 +1,48 @@ + + + + + Microsoft.EntityFrameworkCore.DynamicLinq + ../Microsoft.EntityFrameworkCore.DynamicLinq.EFCore2/Microsoft.EntityFrameworkCore.DynamicLinq.snk + Microsoft.EntityFrameworkCore.DynamicLinq + $(DefineConstants);EFCORE;EFCORE_3X;EFDYNAMICFUNCTIONS;ASYNCENUMERABLE + Dynamic Linq extensions for Microsoft.EntityFrameworkCore which adds Async support + system;linq;dynamic;entityframework;core;async + {9000129D-322D-4FE6-9C47-75464577C374} + net8.0 + 8.3.$(PatchVersion) + + + + full + + + + + portable + true + + + + net8.0 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Properties/AssemblyInfo.cs b/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..54dd50af --- /dev/null +++ b/src/Microsoft.EntityFrameworkCore.DynamicLinq.EFCore8/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Runtime.InteropServices; + +[assembly: ComVisible(false)] +#if !(WINDOWS_APP || NETSTANDARD2_1) +[assembly: Guid("b467c675-c014-4b55-85b9-9578941d2ef7")] +#endif diff --git a/src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj b/src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj index a1cfec9f..b7797926 100644 --- a/src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj +++ b/src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.csproj @@ -9,7 +9,7 @@ This is a .NETStandard / .NET Core port of the the Microsoft assembly for the .Net 4.0 Dynamic language functionality. system;linq;dynamic;core;dotnet;NETCoreApp;NETStandard {D3804228-91F4-4502-9595-39584E510002} - net35;net40;net45;net452;net46;netstandard1.3;netstandard2.0;netstandard2.1;uap10.0;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 + net35;net40;net45;net452;net46;netstandard1.3;netstandard2.0;netstandard2.1;uap10.0;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 1.3.$(PatchVersion) @@ -26,14 +26,14 @@ - net40;net45;net46;netstandard1.3;netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 + net40;net45;net46;netstandard1.3;netstandard2.0;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 $(DefineConstants);NETSTANDARD - + $(DefineConstants);ASYNCENUMERABLE diff --git a/test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj b/test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj index 9ac38766..2bbc533b 100644 --- a/test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj +++ b/test/System.Linq.Dynamic.Core.Tests.Net6/System.Linq.Dynamic.Core.Tests.Net6.csproj @@ -7,7 +7,6 @@ True ../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk false - $(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1 diff --git a/test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj b/test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj new file mode 100644 index 00000000..f3638314 --- /dev/null +++ b/test/System.Linq.Dynamic.Core.Tests.Net8/System.Linq.Dynamic.Core.Tests.Net8.csproj @@ -0,0 +1,57 @@ + + + + net8.0 + System.Linq.Dynamic.Core.Tests + full + True + ../../src/System.Linq.Dynamic.Core/System.Linq.Dynamic.Core.snk + false + enable + $(DefineConstants);NETCOREAPP;EFCORE;EFCORE_3X;NETCOREAPP3_1 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FormattableString.cs b/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FormattableString.cs index 478054cf..9488dae5 100644 --- a/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FormattableString.cs +++ b/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.FormattableString.cs @@ -139,6 +139,7 @@ public async Task Entities_LongCountAsync_Predicate_Args_FS() Assert.Equal(expected, result); } + [Fact(Skip = "not supported")] public void Entities_TakeWhile_FS() { //Arrange diff --git a/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.TakeWhile.cs b/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.TakeWhile.cs index 9dbffb02..cc7973e6 100644 --- a/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.TakeWhile.cs +++ b/test/System.Linq.Dynamic.Core.Tests/EntitiesTests.TakeWhile.cs @@ -6,6 +6,7 @@ namespace System.Linq.Dynamic.Core.Tests public partial class EntitiesTests { // Not supported : https://msdn.microsoft.com/en-in/library/bb738474%28en-us%29.aspx + [Fact(Skip = "not supported")] public void Entities_TakeWhile() { //Arrange diff --git a/test/System.Linq.Dynamic.Core.Tests/Parser/StringParserTests.cs b/test/System.Linq.Dynamic.Core.Tests/Parser/StringParserTests.cs index aa5ad8b9..af42df75 100644 --- a/test/System.Linq.Dynamic.Core.Tests/Parser/StringParserTests.cs +++ b/test/System.Linq.Dynamic.Core.Tests/Parser/StringParserTests.cs @@ -56,7 +56,7 @@ public void StringParser_With_UnexpectedUnrecognizedEscapeSequence_ThrowsExcepti // Assert var parseException = action.Should().Throw(); - parseException.Which.InnerException!.Message.Should().Contain("Insufficient hexadecimal digits"); + parseException.Which.InnerException!.Message.Should().Contain("hexadecimal digits"); parseException.Which.StackTrace.Should().Contain("at System.Linq.Dynamic.Core.Parser.StringParser.ParseString(String s) in ").And.Contain("System.Linq.Dynamic.Core\\Parser\\StringParser.cs:line "); } diff --git a/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs b/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs index 0e48885f..8e963f71 100644 --- a/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs +++ b/test/System.Linq.Dynamic.Core.Tests/QueryableTests.Where.cs @@ -150,7 +150,7 @@ public void Where_Dynamic_Exceptions() Assert.Throws(() => qry.Where("Id=123")); Assert.Throws(() => DynamicQueryableExtensions.Where(null, "Id=1")); - Assert.Throws(() => qry.Where((string)null)); + Assert.Throws(() => qry.Where((string?)null)); Assert.Throws(() => qry.Where("")); Assert.Throws(() => qry.Where(" ")); }