Hlibz.Paging 1.0.0-preview.2

This is a prerelease version of Hlibz.Paging.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Hlibz.Paging --version 1.0.0-preview.2
                    
NuGet\Install-Package Hlibz.Paging -Version 1.0.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hlibz.Paging" Version="1.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hlibz.Paging" Version="1.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Hlibz.Paging" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hlibz.Paging --version 1.0.0-preview.2
                    
#r "nuget: Hlibz.Paging, 1.0.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hlibz.Paging@1.0.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hlibz.Paging&version=1.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Hlibz.Paging&version=1.0.0-preview.2&prerelease
                    
Install as a Cake Tool

Hlibz.Paging icon

Hlibz.Paging

NuGet CI

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. ValidateAll fails startup on a DTO without exactly one default: every DTO in the assemblies you pass (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.All is one page with every item.
  • SortingParams: sort keys in order. OrderBy(SortingParams) sorts strings case-insensitively; with no keys, by Id.
  • PagedData<T>: the page's items and PagingMetadata (TotalItems, CurrentPage, PerPage, TotalPages, HasNextPage). Every property is required, so an OpenAPI schema lists them all as required, and both read back from JSON.
  • Hlibz.Paging.EntityFrameworkCore: PaginateAsync loads 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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