Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Getting Started with EricksonLopez.Pagination

L2StableNuGet: v2.0.0Local HEAD: v3.0.0AOT: Partial

Install EricksonLopez.Pagination (2.0.0 on NuGet) together with EricksonLopez.Pagination.Result and your data access adapter (Dapper, EntityFrameworkCore, or LinqToDB).

dotnet add package EricksonLopez.Pagination --version 2.0.0
Terminal window
dotnet add package EricksonLopez.Pagination.Result --version 2.0.0
dotnet add package EricksonLopez.Pagination.Dapper --version 2.0.0

HmacCursorEncoder requires a secretKey of at least 32 UTF-8 bytes:

using System;
using System.Threading;
using System.Threading.Tasks;
using EricksonLopez.Pagination;
using EricksonLopez.Pagination.Abstractions;
using EricksonLopez.Pagination.Result;
using EricksonLopez.Result;
namespace Example.PaginationQuickStart;
public static class CursorPaginationUsage
{
public static HmacCursorEncoder CreateEncoder(string secretKey) =>
new(
secretKey: secretKey,
timeToLive: TimeSpan.FromMinutes(30),
clockSkewTolerance: TimeSpan.FromSeconds(30));
public static async Task<Result<ICursorPagedList<string>>> ExecuteSafePageAsync(
Func<Task<ICursorPagedList<string>>> query,
CancellationToken ct)
{
ct.ThrowIfCancellationRequested();
return await PaginationResultExtensions.ExecuteResultAsync(query);
}
}