Skip to content

Commit 2659e4c

Browse files
author
ps.sergeev
committed
define and use constants based on ef version, not dotnet one
1 parent 5672bd7 commit 2659e4c

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

EntityFrameworkCore.UseRowNumberForPaging/EntityFrameworkCore.UseRowNumberForPaging.csproj

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
5-
<Version>0.7</Version>
65
<Authors>Rwing</Authors>
76
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
87
<RepositoryUrl>https://github.com/Rwing/EntityFrameworkCore.UseRowNumberForPaging</RepositoryUrl>
@@ -13,6 +12,18 @@
1312
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1413
<DebugType>embedded</DebugType>
1514
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<UseEfCore8>false</UseEfCore8>
16+
<UseEfCore9>true</UseEfCore9>
17+
</PropertyGroup>
18+
19+
<PropertyGroup Condition="'$(UseEfCore8)' == 'true'">
20+
<DefineConstants>$(DefineConstants);USE_EF_CORE_8</DefineConstants>
21+
<Version>0.8</Version>
22+
</PropertyGroup>
23+
24+
<PropertyGroup Condition="'$(UseEfCore9)' == 'true'">
25+
<DefineConstants>$(DefineConstants);USE_EF_CORE_9</DefineConstants>
26+
<Version>0.9</Version>
1627
</PropertyGroup>
1728

1829
<PropertyGroup Condition="$(TargetFramework) != 'net9.0'">
@@ -23,11 +34,11 @@
2334
<ItemGroup>
2435
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
2536
</ItemGroup>
26-
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
37+
<ItemGroup Condition="'$(UseEfCore8)' == 'true'">
2738
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
2839
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
2940
</ItemGroup>
30-
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
41+
<ItemGroup Condition="'$(UseEfCore9)' == 'true'">
3142
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
3243
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
3344
</ItemGroup>

EntityFrameworkCore.UseRowNumberForPaging/Offset2RowNumberConvertVisitor.net8.cs renamed to EntityFrameworkCore.UseRowNumberForPaging/Offset2RowNumberConvertVisitor.EfCore8.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if !NET9_0_OR_GREATER
1+
#if USE_EF_CORE_8
22
using System;
33
using System.Collections.Generic;
44
using System.Linq;

EntityFrameworkCore.UseRowNumberForPaging/Offset2RowNumberConvertVisitor.net9.cs renamed to EntityFrameworkCore.UseRowNumberForPaging/Offset2RowNumberConvertVisitor.EfCore9.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET9_0_OR_GREATER
1+
#if USE_EF_CORE_9
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Linq.Expressions;

EntityFrameworkCore.UseRowNumberForPaging/SqlServer2008QueryTranslationPostprocessorFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public virtual QueryTranslationPostprocessor Create(QueryCompilationContext quer
1717
=> new SqlServer2008QueryTranslationPostprocessor(
1818
_dependencies,
1919
_relationalDependencies,
20-
#if NET9_0_OR_GREATER
20+
#if USE_EF_CORE_9
2121
(RelationalQueryCompilationContext)queryCompilationContext
22-
#else
22+
#elif USE_EF_CORE_8
2323
queryCompilationContext
2424
#endif
2525
);
@@ -28,9 +28,9 @@ public class SqlServer2008QueryTranslationPostprocessor : RelationalQueryTransla
2828
public SqlServer2008QueryTranslationPostprocessor(
2929
QueryTranslationPostprocessorDependencies dependencies,
3030
RelationalQueryTranslationPostprocessorDependencies relationalDependencies,
31-
#if NET9_0_OR_GREATER
31+
#if USE_EF_CORE_9
3232
RelationalQueryCompilationContext queryCompilationContext
33-
#else
33+
#elif USE_EF_CORE_8
3434
QueryCompilationContext queryCompilationContext
3535
#endif
3636
)
@@ -40,9 +40,9 @@ QueryCompilationContext queryCompilationContext
4040
public override Expression Process(Expression query)
4141
{
4242
query = base.Process(query);
43-
#if NET9_0_OR_GREATER
43+
#if USE_EF_CORE_9
4444
query = new Offset2RowNumberConvertVisitor(query, RelationalDependencies.SqlExpressionFactory, RelationalQueryCompilationContext.SqlAliasManager).Visit(query);
45-
#else
45+
#elif USE_EF_CORE_8
4646
query = new Offset2RowNumberConvertVisitor(query, RelationalDependencies.SqlExpressionFactory).Visit(query);
4747
#endif
4848
return query;

0 commit comments

Comments
 (0)