Skip to content

Commit d97d21a

Browse files
authored
Move Data APIs into GreenDonut (#7964)
1 parent bb560d1 commit d97d21a

File tree

349 files changed

+6987
-1016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

349 files changed

+6987
-1016
lines changed

.build/Helpers.cs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ static class Helpers
2626
Path.Combine("HotChocolate", "Marten"),
2727
Path.Combine("HotChocolate", "MongoDb"),
2828
Path.Combine("HotChocolate", "OpenApi"),
29-
Path.Combine("HotChocolate", "Pagination"),
3029
Path.Combine("HotChocolate", "Primitives"),
3130
Path.Combine("HotChocolate", "Raven"),
3231
Path.Combine("HotChocolate", "Skimmed"),

src/GreenDonut/Directory.Build.props

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<PropertyGroup>
55
<PackageTags>DataLoader Batching Caching GraphQL ChilliCream Facebook</PackageTags>
66
<PackageIcon>greendonut-signet.png</PackageIcon>
7+
<NoWarn>$(NoWarn);CA1062</NoWarn>
8+
<NeutralLanguage>en</NeutralLanguage>
79
</PropertyGroup>
810

911
</Project>

src/GreenDonut/GreenDonut.sln

+67-34
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,85 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29521.150
5-
MinimumVisualStudioVersion = 15.0.26124.0
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{251185F7-7E3B-4BB3-B500-56C90564EE8C}"
7-
ProjectSection(SolutionItems) = preProject
8-
src\Directory.Build.props = src\Directory.Build.props
9-
EndProjectSection
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3697CA1D-4F24-491C-8C89-F17CBB63F8BC}"
107
EndProject
11-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A829F8F0-4468-405C-8A26-3E5921F7324A}"
12-
ProjectSection(SolutionItems) = preProject
13-
test\Directory.Build.props = test\Directory.Build.props
14-
EndProjectSection
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut", "src\GreenDonut\GreenDonut.csproj", "{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D}"
159
EndProject
16-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenDonut", "src\Core\GreenDonut.csproj", "{FD764A95-F950-40F3-9577-E3168BBC330D}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Abstractions", "src\GreenDonut.Abstractions\GreenDonut.Abstractions.csproj", "{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB}"
1711
EndProject
18-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GreenDonut.Tests", "test\Core.Tests\GreenDonut.Tests.csproj", "{1F96BB47-B053-4E9C-865A-5B6FB613CB0D}"
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data", "src\GreenDonut.Data\GreenDonut.Data.csproj", "{2A37845A-EDC7-4A32-8103-2D86448F314D}"
1913
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.Primitives", "src\Data.Primitives\GreenDonut.Data.Primitives.csproj", "{D30715C8-C763-4B36-B502-2991EBF76758}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.Abstractions", "src\GreenDonut.Data.Abstractions\GreenDonut.Data.Abstractions.csproj", "{5F62F5E4-A450-4533-A0CF-64CE62F3DD06}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.EntityFramework", "src\GreenDonut.Data.EntityFramework\GreenDonut.Data.EntityFramework.csproj", "{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA}"
17+
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.Primitives", "src\GreenDonut.Data.Primitives\GreenDonut.Data.Primitives.csproj", "{211F2EF0-2E15-4C58-B195-3E7665558645}"
19+
EndProject
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{26D53CCB-1C96-4160-B9F6-F8A6A7207EDD}"
21+
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Tests", "test\GreenDonut.Tests\GreenDonut.Tests.csproj", "{61879EC3-D0DC-4743-890A-6EE19D43E81B}"
23+
EndProject
24+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.EntityFramework.Tests", "test\GreenDonut.Data.EntityFramework.Tests\GreenDonut.Data.EntityFramework.Tests.csproj", "{72C43DC2-194C-4493-8673-938AF0BC3336}"
25+
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GreenDonut.Data.Tests", "test\GreenDonut.Data.Tests\GreenDonut.Data.Tests.csproj", "{28AA2DCE-F97B-431F-90E7-B4D4F4636430}"
2127
EndProject
2228
Global
2329
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2430
Debug|Any CPU = Debug|Any CPU
2531
Release|Any CPU = Release|Any CPU
2632
EndGlobalSection
27-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28-
{FD764A95-F950-40F3-9577-E3168BBC330D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{FD764A95-F950-40F3-9577-E3168BBC330D}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{FD764A95-F950-40F3-9577-E3168BBC330D}.Release|Any CPU.ActiveCfg = Release|Any CPU
31-
{FD764A95-F950-40F3-9577-E3168BBC330D}.Release|Any CPU.Build.0 = Release|Any CPU
32-
{1F96BB47-B053-4E9C-865A-5B6FB613CB0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{1F96BB47-B053-4E9C-865A-5B6FB613CB0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{1F96BB47-B053-4E9C-865A-5B6FB613CB0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{1F96BB47-B053-4E9C-865A-5B6FB613CB0D}.Release|Any CPU.Build.0 = Release|Any CPU
36-
{D30715C8-C763-4B36-B502-2991EBF76758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37-
{D30715C8-C763-4B36-B502-2991EBF76758}.Debug|Any CPU.Build.0 = Debug|Any CPU
38-
{D30715C8-C763-4B36-B502-2991EBF76758}.Release|Any CPU.ActiveCfg = Release|Any CPU
39-
{D30715C8-C763-4B36-B502-2991EBF76758}.Release|Any CPU.Build.0 = Release|Any CPU
40-
EndGlobalSection
4133
GlobalSection(SolutionProperties) = preSolution
4234
HideSolutionNode = FALSE
4335
EndGlobalSection
44-
GlobalSection(NestedProjects) = preSolution
45-
{FD764A95-F950-40F3-9577-E3168BBC330D} = {251185F7-7E3B-4BB3-B500-56C90564EE8C}
46-
{1F96BB47-B053-4E9C-865A-5B6FB613CB0D} = {A829F8F0-4468-405C-8A26-3E5921F7324A}
47-
{D30715C8-C763-4B36-B502-2991EBF76758} = {251185F7-7E3B-4BB3-B500-56C90564EE8C}
36+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
37+
{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB}.Release|Any CPU.Build.0 = Release|Any CPU
45+
{2A37845A-EDC7-4A32-8103-2D86448F314D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{2A37845A-EDC7-4A32-8103-2D86448F314D}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{2A37845A-EDC7-4A32-8103-2D86448F314D}.Release|Any CPU.ActiveCfg = Release|Any CPU
48+
{2A37845A-EDC7-4A32-8103-2D86448F314D}.Release|Any CPU.Build.0 = Release|Any CPU
49+
{5F62F5E4-A450-4533-A0CF-64CE62F3DD06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50+
{5F62F5E4-A450-4533-A0CF-64CE62F3DD06}.Debug|Any CPU.Build.0 = Debug|Any CPU
51+
{5F62F5E4-A450-4533-A0CF-64CE62F3DD06}.Release|Any CPU.ActiveCfg = Release|Any CPU
52+
{5F62F5E4-A450-4533-A0CF-64CE62F3DD06}.Release|Any CPU.Build.0 = Release|Any CPU
53+
{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
54+
{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
55+
{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{211F2EF0-2E15-4C58-B195-3E7665558645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58+
{211F2EF0-2E15-4C58-B195-3E7665558645}.Debug|Any CPU.Build.0 = Debug|Any CPU
59+
{211F2EF0-2E15-4C58-B195-3E7665558645}.Release|Any CPU.ActiveCfg = Release|Any CPU
60+
{211F2EF0-2E15-4C58-B195-3E7665558645}.Release|Any CPU.Build.0 = Release|Any CPU
61+
{61879EC3-D0DC-4743-890A-6EE19D43E81B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62+
{61879EC3-D0DC-4743-890A-6EE19D43E81B}.Debug|Any CPU.Build.0 = Debug|Any CPU
63+
{61879EC3-D0DC-4743-890A-6EE19D43E81B}.Release|Any CPU.ActiveCfg = Release|Any CPU
64+
{61879EC3-D0DC-4743-890A-6EE19D43E81B}.Release|Any CPU.Build.0 = Release|Any CPU
65+
{72C43DC2-194C-4493-8673-938AF0BC3336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
66+
{72C43DC2-194C-4493-8673-938AF0BC3336}.Debug|Any CPU.Build.0 = Debug|Any CPU
67+
{72C43DC2-194C-4493-8673-938AF0BC3336}.Release|Any CPU.ActiveCfg = Release|Any CPU
68+
{72C43DC2-194C-4493-8673-938AF0BC3336}.Release|Any CPU.Build.0 = Release|Any CPU
69+
{28AA2DCE-F97B-431F-90E7-B4D4F4636430}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70+
{28AA2DCE-F97B-431F-90E7-B4D4F4636430}.Debug|Any CPU.Build.0 = Debug|Any CPU
71+
{28AA2DCE-F97B-431F-90E7-B4D4F4636430}.Release|Any CPU.ActiveCfg = Release|Any CPU
72+
{28AA2DCE-F97B-431F-90E7-B4D4F4636430}.Release|Any CPU.Build.0 = Release|Any CPU
4873
EndGlobalSection
49-
GlobalSection(ExtensibilityGlobals) = postSolution
50-
SolutionGuid = {CC1769AF-BDF5-4EF2-AED8-1719C180F131}
74+
GlobalSection(NestedProjects) = preSolution
75+
{D596ABFF-2B7E-42A1-ABF9-ECCE2C4E656D} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
76+
{7FD1006E-CB9A-4EC2-BCCC-7EF412B062EB} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
77+
{2A37845A-EDC7-4A32-8103-2D86448F314D} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
78+
{5F62F5E4-A450-4533-A0CF-64CE62F3DD06} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
79+
{BA537BF3-3B52-42C9-9608-4EE7C1ACB0BA} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
80+
{211F2EF0-2E15-4C58-B195-3E7665558645} = {3697CA1D-4F24-491C-8C89-F17CBB63F8BC}
81+
{61879EC3-D0DC-4743-890A-6EE19D43E81B} = {26D53CCB-1C96-4160-B9F6-F8A6A7207EDD}
82+
{72C43DC2-194C-4493-8673-938AF0BC3336} = {26D53CCB-1C96-4160-B9F6-F8A6A7207EDD}
83+
{28AA2DCE-F97B-431F-90E7-B4D4F4636430} = {26D53CCB-1C96-4160-B9F6-F8A6A7207EDD}
5184
EndGlobalSection
5285
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
2+
3+
<PropertyGroup>
4+
<PackageId>GreenDonut.Abstractions</PackageId>
5+
<AssemblyName>GreenDonut.Abstractions</AssemblyName>
6+
<RootNamespace>GreenDonut</RootNamespace>
7+
<Description>This package provided GreenDonut DataLoader interfaces and base types.</Description>
8+
</PropertyGroup>
9+
10+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PackageId>GreenDonut.Data.Abstractions</PackageId>
5+
<AssemblyName>GreenDonut.Data.Abstractions</AssemblyName>
6+
<RootNamespace>GreenDonut.Data</RootNamespace>
7+
<Description>This package provides data integrations like pagination, projections, filtering and sorting.</Description>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\GreenDonut.Abstractions\GreenDonut.Abstractions.csproj" />
12+
<ProjectReference Include="..\GreenDonut.Data.Primitives\GreenDonut.Data.Primitives.csproj" />
13+
</ItemGroup>
14+
15+
</Project>

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/ExpressionHelpers.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
using System.Linq.Expressions;
33
using System.Reflection;
44
using System.Runtime.InteropServices;
5+
using GreenDonut.Data.Cursors;
56

6-
namespace HotChocolate.Pagination.Expressions;
7+
namespace GreenDonut.Data.Expressions;
78

89
/// <summary>
910
/// This class provides helper methods to build slicing where clauses.
1011
/// </summary>
11-
public static class ExpressionHelpers
12+
internal static class ExpressionHelpers
1213
{
1314
private static readonly MethodInfo _createAndConvert = typeof(ExpressionHelpers)
1415
.GetMethod(nameof(CreateAndConvertParameter), BindingFlags.NonPublic | BindingFlags.Static)!;

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Expressions/ExtractOrderPropertiesVisitor.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExtractOrderPropertiesVisitor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
22

3-
namespace HotChocolate.Pagination.Expressions;
3+
namespace GreenDonut.Data.Expressions;
44

55
internal sealed class ExtractOrderPropertiesVisitor : ExpressionVisitor
66
{

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Expressions/ExtractSelectExpressionVisitor.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExtractSelectExpressionVisitor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
22

3-
namespace HotChocolate.Pagination.Expressions;
3+
namespace GreenDonut.Data.Expressions;
44

55
internal sealed class ExtractSelectExpressionVisitor : ExpressionVisitor
66
{

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Expressions/QueryHelpers.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/QueryHelpers.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
22

3-
namespace HotChocolate.Pagination.Expressions;
3+
namespace GreenDonut.Data.Expressions;
44

55
internal static class QueryHelpers
66
{

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Expressions/ReplaceSelectorVisitor.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ReplaceSelectorVisitor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
22

3-
namespace HotChocolate.Pagination.Expressions;
3+
namespace GreenDonut.Data.Expressions;
44

55
internal sealed class ReplaceSelectorVisitor<T>(
66
Expression<Func<T, T>> newSelector)

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Expressions/ReplacerParameterVisitor.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ReplacerParameterVisitor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
22

3-
namespace HotChocolate.Pagination.Expressions;
3+
namespace GreenDonut.Data.Expressions;
44

55
internal sealed class ReplacerParameterVisitor(
66
ParameterExpression oldParameter,

src/HotChocolate/Pagination/src/Pagination.EntityFramework/Extensions/PagingQueryableExtensions.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/Extensions/PagingQueryableExtensions.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
using System.Collections.Immutable;
33
using System.Linq.Expressions;
44
using System.Reflection;
5-
using HotChocolate.Pagination.Expressions;
6-
using static HotChocolate.Pagination.Expressions.ExpressionHelpers;
5+
using GreenDonut.Data.Cursors;
6+
using GreenDonut.Data.Expressions;
7+
using Microsoft.EntityFrameworkCore;
8+
using static GreenDonut.Data.Expressions.ExpressionHelpers;
79

8-
namespace HotChocolate.Pagination;
10+
// ReSharper disable once CheckNamespace
11+
namespace GreenDonut.Data;
912

1013
/// <summary>
1114
/// Provides extension methods to page a queryable.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PackageId>GreenDonut.Data.EntityFramework</PackageId>
5+
<AssemblyName>GreenDonut.Data.EntityFramework</AssemblyName>
6+
<RootNamespace>GreenDonut.Data</RootNamespace>
7+
<Description>This package provides data integrations like pagination, projections, filtering and sorting.</Description>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<InternalsVisibleTo Include="HotChocolate.Data.EntityFramework" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\GreenDonut.Data\GreenDonut.Data.csproj" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<PackageReference Include="Microsoft.EntityFrameworkCore"/>
20+
</ItemGroup>
21+
22+
</Project>

src/HotChocolate/Pagination/src/Pagination.EntityFramework/PagingQueryInterceptor.cs src/GreenDonut/src/GreenDonut.Data.EntityFramework/PagingQueryInterceptor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace HotChocolate.Pagination;
1+
namespace GreenDonut.Data;
22

33
/// <summary>
44
/// This interceptor allows to capture paging queries for analysis.

src/HotChocolate/Pagination/src/Pagination.Primitives/Page.cs src/GreenDonut/src/GreenDonut.Data.Primitives/Page.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections;
22
using System.Collections.Immutable;
33

4-
namespace HotChocolate.Pagination;
4+
namespace GreenDonut.Data;
55

66
/// <summary>
77
/// Represents a page of a result set.

src/HotChocolate/Pagination/src/Pagination.Primitives/PagingArguments.cs src/GreenDonut/src/GreenDonut.Data.Primitives/PagingArguments.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace HotChocolate.Pagination;
1+
namespace GreenDonut.Data;
22

33
/// <summary>
44
/// The paging arguments are used to specify the paging behavior.

src/GreenDonut/src/Data.Primitives/SortBy.cs src/GreenDonut/src/GreenDonut.Data.Primitives/SortBy.cs

+25
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,28 @@ public IOrderedQueryable<TEntity> ApplyThenBy(IOrderedQueryable<TEntity> queryab
8080
return queryable.ThenByDescending(KeySelector);
8181
}
8282
}
83+
84+
public static class SortBy<TEntity>
85+
{
86+
public static SortBy<TEntity, TValue> Ascending<TValue>(
87+
Expression<Func<TEntity, TValue>> keySelector)
88+
{
89+
if (keySelector is null)
90+
{
91+
throw new ArgumentNullException(nameof(keySelector));
92+
}
93+
94+
return new SortBy<TEntity, TValue>(keySelector, true);
95+
}
96+
97+
public static SortBy<TEntity, TValue> Descending<TValue>(
98+
Expression<Func<TEntity, TValue>> keySelector)
99+
{
100+
if (keySelector is null)
101+
{
102+
throw new ArgumentNullException(nameof(keySelector));
103+
}
104+
105+
return new SortBy<TEntity, TValue>(keySelector, false);
106+
}
107+
}

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/CursorFormatter.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorFormatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Buffers.Text;
33
using System.Text;
44

5-
namespace HotChocolate.Pagination.Expressions;
5+
namespace GreenDonut.Data.Cursors;
66

77
/// <summary>
88
/// A helper class to format a cursor for an entity.

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/CursorKey.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKey.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Linq.Expressions;
22
using System.Reflection;
3-
using HotChocolate.Pagination.Serialization;
3+
using GreenDonut.Data.Cursors.Serializers;
44

5-
namespace HotChocolate.Pagination.Expressions;
5+
namespace GreenDonut.Data.Cursors;
66

77
/// <summary>
88
/// Represents a cursor key of an entity type.

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/CursorKeyDirection.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeyDirection.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace HotChocolate.Pagination.Expressions;
1+
namespace GreenDonut.Data.Cursors;
22

33
/// <summary>
44
/// Represents the sort direction of a cursor key.

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/CursorKeyParser.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeyParser.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using System.Diagnostics.CodeAnalysis;
22
using System.Linq.Expressions;
3-
using HotChocolate.Pagination.Serialization;
43

5-
namespace HotChocolate.Pagination.Expressions;
4+
namespace GreenDonut.Data.Cursors;
65

76
/// <summary>
87
/// This expression visitor will collect the cursor keys from a query expression.

src/HotChocolate/Pagination/src/Pagination.Core/Serialization/CursorKeySerializerHelper.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerHelper.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System.Buffers;
2+
using GreenDonut.Data.Cursors.Serializers;
23

3-
namespace HotChocolate.Pagination.Serialization;
4+
namespace GreenDonut.Data.Cursors;
45

5-
public static class CursorKeySerializerHelper
6+
internal static class CursorKeySerializerHelper
67
{
78
public static ReadOnlySpan<byte> Null => "\\null"u8;
89
public static ReadOnlySpan<byte> EscapedNull => "\\\\null"u8;

src/HotChocolate/Pagination/src/Pagination.Core/Serialization/CursorKeySerializerRegistration.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorKeySerializerRegistration.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace HotChocolate.Pagination.Serialization;
1+
using GreenDonut.Data.Cursors.Serializers;
2+
3+
namespace GreenDonut.Data.Cursors;
24

35
/// <summary>
46
/// Allows to register and resolve <see cref="ICursorKeySerializer"/>s.

src/HotChocolate/Pagination/src/Pagination.Core/Expressions/CursorParser.cs src/GreenDonut/src/GreenDonut.Data/Cursors/CursorParser.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Buffers.Text;
33
using System.Text;
44

5-
namespace HotChocolate.Pagination.Expressions;
5+
namespace GreenDonut.Data.Cursors;
66

77
/// <summary>
88
/// The cursor parser allows to parser the cursor into its key values.

src/HotChocolate/Pagination/src/Pagination.Core/Serialization/BoolCursorKeySerializer.cs src/GreenDonut/src/GreenDonut.Data/Cursors/Serializers/BoolCursorKeySerializer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Buffers.Text;
22
using System.Reflection;
33

4-
namespace HotChocolate.Pagination.Serialization;
4+
namespace GreenDonut.Data.Cursors.Serializers;
55

66
internal sealed class BoolCursorKeySerializer : ICursorKeySerializer
77
{

src/HotChocolate/Pagination/src/Pagination.Core/Serialization/CompareToResolver.cs src/GreenDonut/src/GreenDonut.Data/Cursors/Serializers/CompareToResolver.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Reflection;
33
using static System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes;
44

5-
namespace HotChocolate.Pagination.Serialization;
5+
namespace GreenDonut.Data.Cursors.Serializers;
66

77
internal static class CompareToResolver
88
{

0 commit comments

Comments
 (0)