Hlibz.Paging
1.0.0
dotnet add package Hlibz.Paging --version 1.0.0
NuGet\Install-Package Hlibz.Paging -Version 1.0.0
<PackageReference Include="Hlibz.Paging" Version="1.0.0" />
<PackageVersion Include="Hlibz.Paging" Version="1.0.0" />
<PackageReference Include="Hlibz.Paging" />
paket add Hlibz.Paging --version 1.0.0
#r "nuget: Hlibz.Paging, 1.0.0"
#:package Hlibz.Paging@1.0.0
#addin nuget:?package=Hlibz.Paging&version=1.0.0
#tool nuget:?package=Hlibz.Paging&version=1.0.0
![]()
Hlibz.Paging
Paging and sorting for list endpoints: the DTO says what clients may sort by, a client's sort string is checked against it, and the LINQ that sorts and pages is built for you. No dependencies.
dotnet add package Hlibz.Paging
using System.ComponentModel;
using Hlibz.Paging;
public sealed class OrderDto
{
[Sortable]
public int Id { get; init; }
[Sortable]
public string CustomerName { get; init; } = "";
[Sortable(IsDefault = true, DefaultDirection = ListSortDirection.Descending)]
public DateTime CreatedAt { get; init; }
}
// sort = "customer_name,created_at:desc" from the query string
if (!SortableDto.For<OrderDto>().TryParse(sort, out SortingParams? sorting, out string? error))
{
return Results.ValidationProblem(new Dictionary<string, string[]> { ["sort"] = [error] });
}
IOrderedQueryable<OrderDto> sorted = orderDtos.OrderBy(sorting); // any IQueryable
PagedData<OrderDto> page = list.Paginate(sorting, new PagingParams(page, perPage)); // in memory
SortableDto.ValidateAll([typeof(OrderDto).Assembly]); // at startup
[Sortable]: which DTO properties clients may sort by, and the default order.SortableDto: parses a sort string (key[:asc|desc],..., keys in any casing) against the DTO, accepting only its sortable properties; errors name what can be sorted by. A DTO without exactly one default is build errorHPAG001;ValidateAllchecks again at startup: every DTO in the assemblies you pass (listed by the package's source generator, no scanning; abstract bases skipped), or just the DTO types you pass.PagingParams: page from 1 (default 1) and page size (default 100); missing or out-of-range values fall back to the defaults.PagingParams.Allis one page with every item.SortingParams: sort keys in order.OrderBy(SortingParams)sorts strings case-insensitively, then byIdto break ties; with no keys, byId.PagedData<T>: the page's items andPagingMetadata(TotalItems,CurrentPage,PerPage,TotalPages,HasNextPage). Every property isrequired, so an OpenAPI schema lists them all as required, and both read back from JSON.
Related packages
- Hlibz.Paging.EntityFrameworkCore:
PaginateAsyncloads a page from the database. - Hlibz.Results: return a bad sort string as
Result.Invalid(new Dictionary<string, string[]> { ["sort"] = [error] }), so it gets the same error body as every other failure.
Full documentation and a sample: github.com/hlib-zinchenko/Hlibz.Paging.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Hlibz.Paging:
| Package | Downloads |
|---|---|
|
Hlibz.Paging.EntityFrameworkCore
PaginateAsync for Entity Framework Core: sorts an IQueryable by Hlibz.Paging's SortingParams, counts it and loads one page in two queries, returning PagedData<T> with its paging metadata. Sorting is translated to SQL, strings compared case-insensitively. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 56 | 11/18/2026 |
| 1.0.0-preview.6 | 77 | 11/14/2026 |
| 1.0.0-preview.5 | 58 | 11/14/2026 |
| 1.0.0-preview.4 | 59 | 11/13/2026 |
| 1.0.0-preview.3 | 57 | 11/13/2026 |
| 1.0.0-preview.2 | 60 | 11/13/2026 |
| 1.0.0-preview.1 | 57 | 11/13/2026 |