mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Merge pull request #5 from koenbeuk/efcore6
[WIP] Added support for EF Core 6
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -19,4 +19,30 @@
|
||||
<Description>Project over properties and functions in your linq queries</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'DebugV1' Or '$(Configuration)' == 'ReleaseV1' ">
|
||||
<EFProjectablesVersion>1</EFProjectablesVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(EFProjectablesVersion)' == '' ">
|
||||
<EFProjectablesVersion>2</EFProjectablesVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" $(EFProjectablesVersion) == 1 ">
|
||||
<DefineConstants>EFPROJECTABLES1</DefineConstants>
|
||||
<TargetFrameworkVersion>netstandard2.0</TargetFrameworkVersion>
|
||||
<MicrosoftExtensionsVersion>3.1.0</MicrosoftExtensionsVersion>
|
||||
<EFCoreVersion>3.1.0</EFCoreVersion>
|
||||
<!-- We're testing against EF Core 5 as its compatible with 3.1.0 and contains additional features -->
|
||||
<TestEFCoreVersion>5.0.10</TestEFCoreVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" $(EFProjectablesVersion) == 2 ">
|
||||
<DefineConstants>EFPROJECTABLES2</DefineConstants>
|
||||
<TargetFrameworkVersion>net6.0</TargetFrameworkVersion>
|
||||
<MicrosoftExtensionsVersion>6.0.0-rc.1.21451.13</MicrosoftExtensionsVersion>
|
||||
<EFCoreVersion>6.0.0-rc.1.21452.10</EFCoreVersion>
|
||||
<TestEFCoreVersion>$(EFCoreVersion)</TestEFCoreVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(TestEFCoreVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
|
||||
@@ -10,9 +10,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EFCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
|
||||
@@ -10,9 +10,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EFCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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;
|
||||
|
||||
+41
-19
@@ -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<string, string> 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests
|
||||
[Fact]
|
||||
public Task ProjectOverMethodTakingDbContext()
|
||||
{
|
||||
using var dbContext = new SampleDbContext<User>();
|
||||
using var dbContext = new SampleDbContext<User>(Infrastructure.CompatibilityMode.Full);
|
||||
|
||||
var query = dbContext.Set<User>()
|
||||
.Select(x => x.GetLastOrderFromExternalDbContext(dbContext));
|
||||
|
||||
+2
-2
@@ -1,14 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(TestEFCoreVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||
<PackageReference Include="ScenarioTests.XUnit" Version="0.5.2" />
|
||||
<PackageReference Include="Verify.Xunit" Version="11.5.0" />
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ namespace EntityFrameworkCore.Projectables.FunctionalTests.ExtensionMethods
|
||||
[Fact]
|
||||
public Task ExtensionMethodAcceptingDbContext()
|
||||
{
|
||||
using var dbContext = new SampleDbContext<Entity>();
|
||||
using var dbContext = new SampleDbContext<Entity>(Infrastructure.CompatibilityMode.Full);
|
||||
|
||||
var sampleQuery = dbContext.Set<Entity>()
|
||||
.Select(x => dbContext.Set<Entity>().Where(y => y.Id > x.Id).FirstOrDefault());
|
||||
|
||||
@@ -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<TEntity> : 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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user