diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 235b304..b717497 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,8 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: [5.0.x] + dotnet-version: [6.0.x] + projectables-version: [1, 2] steps: - uses: actions/checkout@v2 @@ -33,11 +34,11 @@ jobs: dotnet-version: ${{ matrix.dotnet-version }} include-prerelease: True - name: Restore dependencies - run: dotnet restore + run: dotnet restore /p:EFProjectablesVersion=${{ matrix.projectables-version }} - name: Build - run: dotnet build --no-restore + run: dotnet build --no-restore /p:EFProjectablesVersion=${{ matrix.projectables-version }} - name: Test - run: dotnet test --no-build --verbosity normal + run: dotnet test --no-build --verbosity normal /p:EFProjectablesVersion=${{ matrix.projectables-version }} prerelease: needs: build @@ -45,9 +46,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Pack + - name: Pack v1 run: | - dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=1.0.0-pre-$GITHUB_RUN_ID -o nupkg + dotnet pack -v normal -c DebugV1 --include-symbols --include-source -p:PackageVersion=1.0.0-pre-$GITHUB_RUN_ID -o nupkg + - name: Pack v2 + run: | + dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=2.0.0-pre-$GITHUB_RUN_ID -o nupkg - name: Push to GitHub Feed run: | for f in ./nupkg/*.nupkg diff --git a/Directory.Build.props b/Directory.Build.props index 74e8b07..e51cdf3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,4 +19,30 @@ Project over properties and functions in your linq queries + + 1 + + + + 2 + + + + EFPROJECTABLES1 + netstandard2.0 + 3.1.0 + 3.1.0 + + 5.0.10 + + + + EFPROJECTABLES2 + net6.0 + 6.0.0-rc.1.21451.13 + 6.0.0-rc.1.21452.10 + $(EFCoreVersion) + + + \ No newline at end of file diff --git a/EntityFrameworkCore.Projectables.sln b/EntityFrameworkCore.Projectables.sln index 8972b5a..dd47e60 100644 --- a/EntityFrameworkCore.Projectables.sln +++ b/EntityFrameworkCore.Projectables.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31313.381 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31710.8 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A43F1828-D9B6-40F7-82B6-CA0070843E2F}" EndProject @@ -33,50 +33,88 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadmeSample", "samples\Rea EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{D1DB50EE-D639-46B0-8966-D0AA5F569620}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.Projectables.Benchmarks", "benchmarks\EntityFrameworkCore.Projectables.Benchmarks\EntityFrameworkCore.Projectables.Benchmarks.csproj", "{F2F01B61-5FB8-4F96-A6DE-824C9756B365}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Projectables.Benchmarks", "benchmarks\EntityFrameworkCore.Projectables.Benchmarks\EntityFrameworkCore.Projectables.Benchmarks.csproj", "{F2F01B61-5FB8-4F96-A6DE-824C9756B365}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + DebugV1|Any CPU = DebugV1|Any CPU Release|Any CPU = Release|Any CPU + ReleaseV1|Any CPU = ReleaseV1|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {698E3EEC-64F9-4F96-B700-D61D04FD0704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {698E3EEC-64F9-4F96-B700-D61D04FD0704}.Debug|Any CPU.Build.0 = Debug|Any CPU + {698E3EEC-64F9-4F96-B700-D61D04FD0704}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {698E3EEC-64F9-4F96-B700-D61D04FD0704}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {698E3EEC-64F9-4F96-B700-D61D04FD0704}.Release|Any CPU.ActiveCfg = Release|Any CPU {698E3EEC-64F9-4F96-B700-D61D04FD0704}.Release|Any CPU.Build.0 = Release|Any CPU + {698E3EEC-64F9-4F96-B700-D61D04FD0704}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {698E3EEC-64F9-4F96-B700-D61D04FD0704}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {20F85652-2923-4211-9262-C64BA8C9ED89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20F85652-2923-4211-9262-C64BA8C9ED89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20F85652-2923-4211-9262-C64BA8C9ED89}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {20F85652-2923-4211-9262-C64BA8C9ED89}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {20F85652-2923-4211-9262-C64BA8C9ED89}.Release|Any CPU.ActiveCfg = Release|Any CPU {20F85652-2923-4211-9262-C64BA8C9ED89}.Release|Any CPU.Build.0 = Release|Any CPU + {20F85652-2923-4211-9262-C64BA8C9ED89}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {20F85652-2923-4211-9262-C64BA8C9ED89}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.Release|Any CPU.Build.0 = Release|Any CPU + {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {EE4D6CC1-78DE-4279-A567-C3D360C479F8}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Release|Any CPU.ActiveCfg = Release|Any CPU {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.Release|Any CPU.Build.0 = Release|Any CPU + {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {1B4A8710-4182-494D-B1C5-6B7CDB9C9DB9}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {C8038180-36F8-4077-922B-91F428EAC7D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C8038180-36F8-4077-922B-91F428EAC7D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8038180-36F8-4077-922B-91F428EAC7D9}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {C8038180-36F8-4077-922B-91F428EAC7D9}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {C8038180-36F8-4077-922B-91F428EAC7D9}.Release|Any CPU.ActiveCfg = Release|Any CPU {C8038180-36F8-4077-922B-91F428EAC7D9}.Release|Any CPU.Build.0 = Release|Any CPU + {C8038180-36F8-4077-922B-91F428EAC7D9}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {C8038180-36F8-4077-922B-91F428EAC7D9}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {2F0DD7D7-867F-4478-9E22-45C114B61C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F0DD7D7-867F-4478-9E22-45C114B61C46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F0DD7D7-867F-4478-9E22-45C114B61C46}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {2F0DD7D7-867F-4478-9E22-45C114B61C46}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {2F0DD7D7-867F-4478-9E22-45C114B61C46}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F0DD7D7-867F-4478-9E22-45C114B61C46}.Release|Any CPU.Build.0 = Release|Any CPU + {2F0DD7D7-867F-4478-9E22-45C114B61C46}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {2F0DD7D7-867F-4478-9E22-45C114B61C46}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {A36F5471-0C16-4453-811B-818326931313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A36F5471-0C16-4453-811B-818326931313}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A36F5471-0C16-4453-811B-818326931313}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {A36F5471-0C16-4453-811B-818326931313}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {A36F5471-0C16-4453-811B-818326931313}.Release|Any CPU.ActiveCfg = Release|Any CPU {A36F5471-0C16-4453-811B-818326931313}.Release|Any CPU.Build.0 = Release|Any CPU + {A36F5471-0C16-4453-811B-818326931313}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {A36F5471-0C16-4453-811B-818326931313}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {6F63E04C-9267-4211-8AC7-290C60331D60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6F63E04C-9267-4211-8AC7-290C60331D60}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F63E04C-9267-4211-8AC7-290C60331D60}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {6F63E04C-9267-4211-8AC7-290C60331D60}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {6F63E04C-9267-4211-8AC7-290C60331D60}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F63E04C-9267-4211-8AC7-290C60331D60}.Release|Any CPU.Build.0 = Release|Any CPU + {6F63E04C-9267-4211-8AC7-290C60331D60}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {6F63E04C-9267-4211-8AC7-290C60331D60}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.DebugV1|Any CPU.ActiveCfg = DebugV1|Any CPU + {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.DebugV1|Any CPU.Build.0 = DebugV1|Any CPU {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.Release|Any CPU.Build.0 = Release|Any CPU + {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.ReleaseV1|Any CPU.ActiveCfg = Release|Any CPU + {F2F01B61-5FB8-4F96-A6DE-824C9756B365}.ReleaseV1|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/benchmarks/EntityFrameworkCore.Projectables.Benchmarks/EntityFrameworkCore.Projectables.Benchmarks.csproj b/benchmarks/EntityFrameworkCore.Projectables.Benchmarks/EntityFrameworkCore.Projectables.Benchmarks.csproj index 84b7845..43dedc2 100644 --- a/benchmarks/EntityFrameworkCore.Projectables.Benchmarks/EntityFrameworkCore.Projectables.Benchmarks.csproj +++ b/benchmarks/EntityFrameworkCore.Projectables.Benchmarks/EntityFrameworkCore.Projectables.Benchmarks.csproj @@ -2,13 +2,13 @@ Exe - net5.0 + net6.0 false - + diff --git a/samples/BasicSample/BasicSample.csproj b/samples/BasicSample/BasicSample.csproj index de68914..8f6c4c9 100644 --- a/samples/BasicSample/BasicSample.csproj +++ b/samples/BasicSample/BasicSample.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 disable true $(BaseIntermediateOutputPath)Generated @@ -10,9 +10,9 @@ - - - + + + diff --git a/samples/ReadmeSample/Program.cs b/samples/ReadmeSample/Program.cs index dea800f..94d551f 100644 --- a/samples/ReadmeSample/Program.cs +++ b/samples/ReadmeSample/Program.cs @@ -43,7 +43,6 @@ namespace ReadmeSample Console.WriteLine($"Jons latest order had a grant total of {result.GrandTotal}"); Console.WriteLine($"The following query was used to fetch the results:"); - Console.WriteLine(query.ToQueryString()); } } } diff --git a/samples/ReadmeSample/ReadmeSample.csproj b/samples/ReadmeSample/ReadmeSample.csproj index a3d0ca2..2fec548 100644 --- a/samples/ReadmeSample/ReadmeSample.csproj +++ b/samples/ReadmeSample/ReadmeSample.csproj @@ -2,7 +2,7 @@ Exe - net5.0 + net6.0 disable true $(BaseIntermediateOutputPath)Generated @@ -10,9 +10,9 @@ - - - + + + diff --git a/src/EntityFrameworkCore.Projectables.Generator/EntityFrameworkCore.Projectables.Generator.csproj b/src/EntityFrameworkCore.Projectables.Generator/EntityFrameworkCore.Projectables.Generator.csproj index ad47fb2..4c40f73 100644 --- a/src/EntityFrameworkCore.Projectables.Generator/EntityFrameworkCore.Projectables.Generator.csproj +++ b/src/EntityFrameworkCore.Projectables.Generator/EntityFrameworkCore.Projectables.Generator.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/src/EntityFrameworkCore.Projectables/EntityFrameworkCore.Projectables.csproj b/src/EntityFrameworkCore.Projectables/EntityFrameworkCore.Projectables.csproj index 8f870d8..488df6e 100644 --- a/src/EntityFrameworkCore.Projectables/EntityFrameworkCore.Projectables.csproj +++ b/src/EntityFrameworkCore.Projectables/EntityFrameworkCore.Projectables.csproj @@ -1,11 +1,11 @@  - netstandard2.0 + $(TargetFrameworkVersion) - + diff --git a/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs b/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs index 9eb5984..a2b070d 100644 --- a/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs +++ b/src/EntityFrameworkCore.Projectables/Extensions/DbContextOptionsExtensions.cs @@ -1,5 +1,6 @@ using EntityFrameworkCore.Projectables.Infrastructure; using EntityFrameworkCore.Projectables.Infrastructure.Internal; +using ZEntityFrameworkCore.Projectables.Infrastructure.Internal; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using System; diff --git a/src/EntityFrameworkCore.Projectables/Infrastructure/Internal/ProjectionOptionsExtension.cs b/src/EntityFrameworkCore.Projectables/Infrastructure/Internal/ProjectionOptionsExtension.cs index df4c6cb..8d33bcc 100644 --- a/src/EntityFrameworkCore.Projectables/Infrastructure/Internal/ProjectionOptionsExtension.cs +++ b/src/EntityFrameworkCore.Projectables/Infrastructure/Internal/ProjectionOptionsExtension.cs @@ -1,4 +1,6 @@ -using Microsoft.EntityFrameworkCore.Infrastructure; +using EntityFrameworkCore.Projectables.Infrastructure; +using EntityFrameworkCore.Projectables.Infrastructure.Internal; +using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.Internal; using Microsoft.Extensions.DependencyInjection; @@ -10,7 +12,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace EntityFrameworkCore.Projectables.Infrastructure.Internal +// The Z in the namespace is not a typo +// We need to make sure that this extension is registered last. +// see: https://github.com/dotnet/efcore/issues/26071 + +namespace ZEntityFrameworkCore.Projectables.Infrastructure.Internal { public class ProjectionOptionsExtension : IDbContextOptionsExtension { @@ -96,29 +102,17 @@ namespace EntityFrameworkCore.Projectables.Infrastructure.Internal sealed class ExtensionInfo : DbContextOptionsExtensionInfo { - private int? _serviceProviderHash; - public ExtensionInfo(IDbContextOptionsExtension extension) : base(extension) { } + private new ProjectionOptionsExtension Extension + => (ProjectionOptionsExtension)base.Extension; + + public override bool IsDatabaseProvider => false; public override string LogFragment => string.Empty; - public override long GetServiceProviderHashCode() - { - if (_serviceProviderHash == null) - { - var hashCode = nameof(ProjectionOptionsExtension).GetHashCode(); - var extension = (ProjectionOptionsExtension)Extension; - - hashCode ^= extension._compatibilityMode.GetHashCode(); - - _serviceProviderHash = hashCode; - } - - return _serviceProviderHash.Value; - } public override void PopulateDebugInfo(IDictionary debugInfo) { @@ -127,8 +121,36 @@ namespace EntityFrameworkCore.Projectables.Infrastructure.Internal throw new ArgumentNullException(nameof(debugInfo)); } - debugInfo["Projectables:CompatibilityMode"] = ((ProjectionOptionsExtension)Extension)._compatibilityMode.ToString(); + debugInfo["Projectables:CompatibilityMode"] = Extension._compatibilityMode.ToString(); } + +#if EFPROJECTABLES1 + public override long GetServiceProviderHashCode() + { + var hashCode = nameof(ProjectionOptionsExtension).GetHashCode(); + + var extension = (ProjectionOptionsExtension)Extension; + + hashCode ^= extension._compatibilityMode.GetHashCode(); + + return hashCode; + } +#endif + +#if EFPROJECTABLES2 + public override int GetServiceProviderHashCode() + { + var hashCode = new HashCode(); + + hashCode.Add(Extension._compatibilityMode); + + return hashCode.ToHashCode(); + } + + + public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) + => other is ExtensionInfo otherInfo && Extension._compatibilityMode == otherInfo.Extension._compatibilityMode; +#endif } } } diff --git a/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs b/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs index d7a3668..85ea51f 100644 --- a/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs +++ b/src/EntityFrameworkCore.Projectables/Infrastructure/ProjectableOptionsBuilder.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using EntityFrameworkCore.Projectables.Infrastructure.Internal; +using ZEntityFrameworkCore.Projectables.Infrastructure.Internal; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; diff --git a/tests/EntityFrameworkCore.Projectables.FunctionalTests/ComplexModelTests.cs b/tests/EntityFrameworkCore.Projectables.FunctionalTests/ComplexModelTests.cs index 84af05c..6ce61b3 100644 --- a/tests/EntityFrameworkCore.Projectables.FunctionalTests/ComplexModelTests.cs +++ b/tests/EntityFrameworkCore.Projectables.FunctionalTests/ComplexModelTests.cs @@ -79,7 +79,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests [Fact] public Task ProjectOverMethodTakingDbContext() { - using var dbContext = new SampleDbContext(); + using var dbContext = new SampleDbContext(Infrastructure.CompatibilityMode.Full); var query = dbContext.Set() .Select(x => x.GetLastOrderFromExternalDbContext(dbContext)); diff --git a/tests/EntityFrameworkCore.Projectables.FunctionalTests/EntityFrameworkCore.Projectables.FunctionalTests.csproj b/tests/EntityFrameworkCore.Projectables.FunctionalTests/EntityFrameworkCore.Projectables.FunctionalTests.csproj index ef2e721..7843c98 100644 --- a/tests/EntityFrameworkCore.Projectables.FunctionalTests/EntityFrameworkCore.Projectables.FunctionalTests.csproj +++ b/tests/EntityFrameworkCore.Projectables.FunctionalTests/EntityFrameworkCore.Projectables.FunctionalTests.csproj @@ -1,14 +1,14 @@  - net5.0 + net6.0 false true $(BaseIntermediateOutputPath)Generated - + diff --git a/tests/EntityFrameworkCore.Projectables.FunctionalTests/ExtensionsMethods/ExtensionMethodTests.cs b/tests/EntityFrameworkCore.Projectables.FunctionalTests/ExtensionsMethods/ExtensionMethodTests.cs index f525e85..fdfe87e 100644 --- a/tests/EntityFrameworkCore.Projectables.FunctionalTests/ExtensionsMethods/ExtensionMethodTests.cs +++ b/tests/EntityFrameworkCore.Projectables.FunctionalTests/ExtensionsMethods/ExtensionMethodTests.cs @@ -52,7 +52,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods [Fact] public Task ExtensionMethodAcceptingDbContext() { - using var dbContext = new SampleDbContext(); + using var dbContext = new SampleDbContext(Infrastructure.CompatibilityMode.Full); var sampleQuery = dbContext.Set() .Select(x => dbContext.Set().Where(y => y.Id > x.Id).FirstOrDefault()); diff --git a/tests/EntityFrameworkCore.Projectables.FunctionalTests/Helpers/SampleDbContext.cs b/tests/EntityFrameworkCore.Projectables.FunctionalTests/Helpers/SampleDbContext.cs index 23320da..6613156 100644 --- a/tests/EntityFrameworkCore.Projectables.FunctionalTests/Helpers/SampleDbContext.cs +++ b/tests/EntityFrameworkCore.Projectables.FunctionalTests/Helpers/SampleDbContext.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using EntityFrameworkCore.Projectables.Extensions; +using EntityFrameworkCore.Projectables.Infrastructure; using Microsoft.EntityFrameworkCore; namespace EntityFrameworkCore.Projectables.FunctionalTests.Helpers @@ -12,11 +13,18 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests.Helpers public class SampleDbContext : DbContext where TEntity : class { + readonly CompatibilityMode _compatibilityMode; + + public SampleDbContext(CompatibilityMode compatibilityMode = CompatibilityMode.Limited) + { + _compatibilityMode = compatibilityMode; + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer("Server=(localdb)\v11.0;Integrated Security=true"); // Fake connection string as we're actually never connecting optionsBuilder.UseProjectables(options => { - options.CompatibilityMode(Infrastructure.CompatibilityMode.Full); // Needed by our ComplexModelTests + options.CompatibilityMode(_compatibilityMode); // Needed by our ComplexModelTests }); } diff --git a/tests/EntityFrameworkCore.Projectables.Generator.Tests/EntityFrameworkCore.Projectables.Generator.Tests.csproj b/tests/EntityFrameworkCore.Projectables.Generator.Tests/EntityFrameworkCore.Projectables.Generator.Tests.csproj index a410933..d1f078e 100644 --- a/tests/EntityFrameworkCore.Projectables.Generator.Tests/EntityFrameworkCore.Projectables.Generator.Tests.csproj +++ b/tests/EntityFrameworkCore.Projectables.Generator.Tests/EntityFrameworkCore.Projectables.Generator.Tests.csproj @@ -1,8 +1,7 @@ - net5.0 - + net6.0 false diff --git a/tests/EntityFrameworkCore.Projectables.Tests/EntityFrameworkCore.Projectables.Tests.csproj b/tests/EntityFrameworkCore.Projectables.Tests/EntityFrameworkCore.Projectables.Tests.csproj index 8d72d5a..5e2a47d 100644 --- a/tests/EntityFrameworkCore.Projectables.Tests/EntityFrameworkCore.Projectables.Tests.csproj +++ b/tests/EntityFrameworkCore.Projectables.Tests/EntityFrameworkCore.Projectables.Tests.csproj @@ -1,8 +1,7 @@  - net5.0 - + net6.0 false