Skip to content

Commit ee33396

Browse files
authored
Merge pull request #15 from yv989c/develop
EF 7 Core support
2 parents 94b29dc + 86d4ce6 commit ee33396

File tree

13 files changed

+91
-3
lines changed

13 files changed

+91
-3
lines changed

BlazarTech.QueryableValues.SqlServer.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1818
Version.xml = Version.xml
1919
EndProjectSection
2020
EndProject
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.EFCore7", "src\QueryableValues.SqlServer.EFCore7\QueryableValues.SqlServer.EFCore7.csproj", "{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}"
22+
EndProject
2123
Global
2224
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2325
Debug|Any CPU = Debug|Any CPU
@@ -48,6 +50,12 @@ Global
4850
{563842B7-B73A-458B-8CC0-381108E36155}.Release|Any CPU.Build.0 = Release|Any CPU
4951
{563842B7-B73A-458B-8CC0-381108E36155}.Test|Any CPU.ActiveCfg = Test|Any CPU
5052
{563842B7-B73A-458B-8CC0-381108E36155}.Test|Any CPU.Build.0 = Test|Any CPU
53+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Test|Any CPU.ActiveCfg = Test|Any CPU
58+
{F7FFB4FE-1E81-41EF-B93E-5EEDA30C2A99}.Test|Any CPU.Build.0 = Test|Any CPU
5159
EndGlobalSection
5260
GlobalSection(SolutionProperties) = preSolution
5361
HideSolutionNode = FALSE

BlazarTech.QueryableValues.sln

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2626
Version.xml = Version.xml
2727
EndProjectSection
2828
EndProject
29+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.EFCore7", "src\QueryableValues.SqlServer.EFCore7\QueryableValues.SqlServer.EFCore7.csproj", "{F8551409-EE9D-4E16-B62B-80926E370AB2}"
30+
EndProject
31+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.Tests.EFCore7", "tests\QueryableValues.SqlServer.Tests.EFCore7\QueryableValues.SqlServer.Tests.EFCore7.csproj", "{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}"
32+
EndProject
2933
Global
3034
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3135
Debug|Any CPU = Debug|Any CPU
@@ -90,6 +94,22 @@ Global
9094
{E6587114-CE45-4D9B-9235-3CBD5B7228B0}.Test_All|Any CPU.Build.0 = Test_All|Any CPU
9195
{E6587114-CE45-4D9B-9235-3CBD5B7228B0}.Test|Any CPU.ActiveCfg = Test|Any CPU
9296
{E6587114-CE45-4D9B-9235-3CBD5B7228B0}.Test|Any CPU.Build.0 = Test|Any CPU
97+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
98+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
99+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
100+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Test_All|Any CPU.ActiveCfg = Test|Any CPU
102+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Test_All|Any CPU.Build.0 = Test|Any CPU
103+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Test|Any CPU.ActiveCfg = Test|Any CPU
104+
{F8551409-EE9D-4E16-B62B-80926E370AB2}.Test|Any CPU.Build.0 = Test|Any CPU
105+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
106+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
107+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
108+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Release|Any CPU.Build.0 = Release|Any CPU
109+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Test_All|Any CPU.ActiveCfg = Test_All|Any CPU
110+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Test_All|Any CPU.Build.0 = Test_All|Any CPU
111+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Test|Any CPU.ActiveCfg = Test|Any CPU
112+
{D5293D2F-4649-4A2B-A50D-E7DBD4AA4A5C}.Test|Any CPU.Build.0 = Test|Any CPU
93113
EndGlobalSection
94114
GlobalSection(SolutionProperties) = preSolution
95115
HideSolutionNode = FALSE

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) Carlos Villegas
3+
Copyright (c) Carlos Villegas ([yv989c](https://github.com/yv989c))
44

55
Contains portions of:
66
- [LINQKit](https://github.com/scottksmith95/LINQKit). Copyright (c) 2007-2019 Joseph Albahari, Tomas Petricek, Scott Smith.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ The supported types for `T` are:
1919

2020
For a detailed explanation of the problem solved by QueryableValues, please continue reading [here][readme-background].
2121

22+
> 💡 Still on Entity Framework 6 (non-core)?
23+
> [This Stack Overflow answer](https://stackoverflow.com/a/70587979/2206145) may be helpful.
24+
2225
## When Should You Use It?
2326
The `AsQueryableValues` extension method is intended for queries that are dependent upon a *non-constant* sequence of external values. In such cases, the underlying SQL query will be efficient on subsequent executions.
2427

@@ -43,6 +46,7 @@ EF Core | Command
4346
3.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 3.4.0`
4447
5.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 5.4.0`
4548
6.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 6.4.0`
49+
7.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 7.0.0-preview.1`
4650

4751
## Configuration
4852
Look for the place in your code where you are setting up your [DbContext] and calling the [UseSqlServer] extension method, then use a lambda expression to access the `SqlServerDbContextOptionsBuilder` provided by it. It is on this builder that you must call the `UseQueryableValues` extension method as shown in the following simplified examples:

Version.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
<VersionEFCore3>3.4.0</VersionEFCore3>
44
<VersionEFCore5>5.4.0</VersionEFCore5>
55
<VersionEFCore6>6.4.0</VersionEFCore6>
6+
<VersionEFCore7>7.0.0-preview.1</VersionEFCore7>
67
</PropertyGroup>
8+
<!--d0816a78-e3a1-44f1-9548-f02338ca15ef-->
79
</Project>

docs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ The supported types for `T` are:
1515

1616
For a detailed explanation of the problem solved by QueryableValues, please continue reading [here][readme-background].
1717

18+
> 💡 Still on Entity Framework 6 (non-core)?
19+
> [This Stack Overflow answer](https://stackoverflow.com/a/70587979/2206145) may be helpful.
20+
1821
## When Should You Use It?
1922
The `AsQueryableValues` extension method is intended for queries that are dependent upon a *non-constant* sequence of external values. In such cases, the underlying SQL query will be efficient on subsequent executions.
2023

@@ -39,6 +42,7 @@ EF Core | Command
3942
3.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 3.4.0`
4043
5.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 5.4.0`
4144
6.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 6.4.0`
45+
7.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 7.0.0-preview.1`
4246

4347
## Configuration
4448
Look for the place in your code where you are setting up your [DbContext] and calling the [UseSqlServer] extension method, then use a lambda expression to access the `SqlServerDbContextOptionsBuilder` provided by it. It is on this builder that you must call the `UseQueryableValues` extension method as shown in the following simplified examples:

src/QueryableValues.SqlServer.EFCore6/QueryableValues.SqlServer.EFCore6.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[6.0,7.0)" />
1414
</ItemGroup>
1515
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="../SharedProjectProperties.xml" />
3+
<Import Project="../../Version.xml" />
4+
5+
<PropertyGroup>
6+
<VersionPrefix>$(VersionEFCore7)</VersionPrefix>
7+
<TargetFramework>net6.0</TargetFramework>
8+
<Configurations>Debug;Release;Test</Configurations>
9+
<DefineConstants>$(DefineConstants);EFCORE;EFCORE7</DefineConstants>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.6.22329.4" />
14+
</ItemGroup>
15+
</Project>

src/QueryableValues.SqlServer/QueryableValuesSqlServerExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
8080
{
8181
}
8282

83-
#if EFCORE6
83+
#if EFCORE6 || EFCORE7
8484
public override int GetServiceProviderHashCode() => 0;
8585
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) => true;
8686
#else

src/SharedProjectProperties.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<Pack>True</Pack>
3131
<PackagePath>\</PackagePath>
3232
</None>
33+
<None Include="..\..\LICENSE.md" Visible="false">
34+
<Pack>True</Pack>
35+
<PackagePath>\</PackagePath>
36+
</None>
3337
</ItemGroup>
3438

3539
<PropertyGroup Condition="'$(Configuration)'=='Release'">
@@ -53,5 +57,6 @@
5357
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore3" />
5458
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore5" />
5559
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore6" />
60+
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore7" />
5661
</ItemGroup>
5762
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="../SharedTestProjectProperties.xml" />
3+
4+
<PropertyGroup>
5+
<AssemblyName>BlazarTech.QueryableValues.SqlServer.Tests.EFCore7</AssemblyName>
6+
<DefineConstants>$(DefineConstants);TESTS;EFCORE7</DefineConstants>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
11+
<PackageReference Include="xunit" Version="2.4.1" />
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
<PrivateAssets>all</PrivateAssets>
15+
</PackageReference>
16+
<PackageReference Include="coverlet.collector" Version="3.1.0">
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
<PrivateAssets>all</PrivateAssets>
19+
</PackageReference>
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<ProjectReference Include="..\..\src\QueryableValues.SqlServer.EFCore7\QueryableValues.SqlServer.EFCore7.csproj" />
24+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.6.22329.4" />
25+
</ItemGroup>
26+
</Project>

tests/QueryableValues.SqlServer.Tests/Integration/MyDbContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ internal static class DatabaseName
99
public const string Name = "QueryableValuesTestsEFCore5";
1010
#elif EFCORE6
1111
public const string Name = "QueryableValuesTestsEFCore6";
12+
#elif EFCORE7
13+
public const string Name = "QueryableValuesTestsEFCore7";
1214
#endif
1315
}
1416

tests/QueryableValues.SqlServer.Tests/Integration/MyDbContextBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ public abstract class MyDbContextBase : DbContext
1111
private readonly bool _useQueryableValues;
1212
private readonly bool _useSelectTopOptimization;
1313

14+
#if !EFCORE3
1415
public event Action<string>? LogEntryEmitted;
16+
#endif
1517

1618
public DbSet<TestDataEntity> TestData { get; set; } = null!;
1719

0 commit comments

Comments
 (0)