SmartPagination 1.0.0

dotnet add package SmartPagination --version 1.0.0
                    
NuGet\Install-Package SmartPagination -Version 1.0.0
                    
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="SmartPagination" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmartPagination" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SmartPagination" />
                    
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 SmartPagination --version 1.0.0
                    
#r "nuget: SmartPagination, 1.0.0"
                    
#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 SmartPagination@1.0.0
                    
#: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=SmartPagination&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SmartPagination&version=1.0.0
                    
Install as a Cake Tool

๐Ÿ“ฆ SmartPagination

๐Ÿš€ A unified pagination engine for .NET APIs (Offset, Cursor, Smart Auto Selection)

SmartPagination is a lightweight, production-ready library that simplifies pagination across your .NET applications using a single, consistent API.

โœจ Features

๐Ÿ“„ Offset Pagination (page-based)

โšก Cursor Pagination (high-performance for large datasets)

๐Ÿง  Smart Auto Pagination (SmartPaginateAsync)

๐Ÿ”Œ Plug & Play with IQueryable<T>

โš™๏ธ Works seamlessly with EF Core

๐Ÿงฉ Clean and minimal API

๐Ÿšซ No Dynamic LINQ dependency

๐Ÿ“ฆ Installation

dotnet add package SmartPagination

๐Ÿš€ Quick Start

Basic Usage (Recommended)

var result = await db.Users

.OrderBy(x โ‡’ x.Id)

.SmartPaginateAsync(new PaginationRequest

{

PageSize = 10

});

Offset Pagination

var result = await db.Users

.OrderBy(x โ‡’ x.Id)

.SmartPaginateAsync(new PaginationRequest

{

PageNumber = 1,

PageSize = 10

});

Cursor Pagination

var result = await db.Users

.OrderBy(x โ‡’ x.Id)

.SmartPaginateAsync(new PaginationRequest

{

Cursor = "25",

PageSize = 10

});

๐Ÿง  How Smart Pagination Works

SmartPagination automatically selects the best strategy:

Condition Strategy

PageNumber provided Offset

Cursor provided Cursor

No OrderBy Cursor (safe fallback)

Default Offset

๐Ÿ“Š Response Model

public class PagedResult<T>

{

public List<T> Items { get; set; }

public int? PageNumber { get; set; }

public string? NextCursor { get; set; }

public bool HasNextPage { get; set; }

}

โš™๏ธ Pagination Request

public class PaginationRequest

{

public int PageSize { get; set; } = 10;

public int? PageNumber { get; set; }

public string? Cursor { get; set; }

public PaginationType Type { get; set; }

}

๐Ÿงช Example: ASP.NET Core API

[HttpGet]

public async Task<IActionResult> GetUsers(int page = 1)

{

var result = await _db.Users

.OrderBy(x โ‡’ x.Id)

.SmartPaginateAsync(new PaginationRequest

{

PageNumber = page,

PageSize = 10

});

return Ok(result);

}

โšก Supported Strategies

๐Ÿ“„ Offset Pagination

Best for:

Admin dashboards

Reports

Small datasets

โšก Cursor Pagination

Best for:

Infinite scroll

Activity feeds

Large datasets

๐Ÿง  Smart Pagination (Recommended)

Best for:

APIs with mixed usage

Unknown scale requirements

Automatic performance optimization

๐Ÿ—๏ธ Requirements

.NET 6 / .NET 7 / .NET 8 / .NET 9

Works with IQueryable<T>

EF Core (optional but recommended)

๐Ÿ”ฅ Why SmartPagination?

โŒ Without it

Rewriting pagination logic every project

Poor performance with large datasets

Inconsistent API behavior

โœ… With it

One consistent pagination API

Automatic strategy selection

Better scalability

Cleaner codebase

๐Ÿ“Œ Roadmap

Seek Pagination (multi-column cursor)

Fluent API (.Paginate().WithCursor())

Performance benchmarking

Caching support

Diagnostics / logging

๐Ÿค Contributing

Contributions are welcome!

Focus areas:

Performance improvements

EF Core optimizations

Developer experience

๐Ÿ“„ License

MIT License

โญ Support

If this package helps you, consider giving it a star โญ on GitHub.

๐Ÿš€ Final Note

Pagination should be solved once โ€” not in every project.

SmartPagination helps you do exactly that.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 106 4/13/2026