CorePagination 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CorePagination --version 0.0.2
NuGet\Install-Package CorePagination -Version 0.0.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="CorePagination" Version="0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CorePagination --version 0.0.2
#r "nuget: CorePagination, 0.0.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.
// Install CorePagination as a Cake Addin
#addin nuget:?package=CorePagination&version=0.0.2

// Install CorePagination as a Cake Tool
#tool nuget:?package=CorePagination&version=0.0.2

CorePagination

CorePagination is a lightweight and easy-to-use pagination library designed specifically for Entity Framework Core (EF Core). It offers a straightforward and extensible way to add pagination functionality to your .NET projects, improving efficiency and management of large datasets.

Features

  • Easy to Integrate: Seamlessly integrates with any EF Core project.
  • Semantic and Short Methods: Makes the code understandable and easy to use.
  • Extensible: Allows for customizations and extensions to fit specific needs.
  • Support for Pagination URLs: Generates URLs for page navigation, ideal for REST APIs.
  • Asynchronous by Nature: Designed for asynchronous operations, leveraging EF Core capabilities.

Requirements

  • .NET Core 3.1 or higher
  • Entity Framework Core 3.1 or higher

CorePagination Usage Examples

Import the CorePagination.Extensions namespace to get started:

using CorePagination.Extensions;

Using PaginateAsync

PaginateAsync is a comprehensive pagination method that provides detailed pagination results, including total item and page counts. It is particularly useful for user interfaces that require detailed pagination controls.

Example with PaginateAsync

Below is an example demonstrating how to use PaginateAsync to paginate a list of Product entities:

var context = new ApplicationDbContext();
var products = context.Products;

int pageNumber = 1;
int pageSize = 10;

var paginationResult = await products.PaginateAsync(pageNumber, pageSize);

// paginationResult includes:
// Items: List of products on the current page.
// TotalItems: Total count of products.
// TotalPages: Total number of pages.
// Page: Current page number.
// PageSize: Number of items per page.

Using SimplePaginateAsync

SimplePaginateAsync provides a basic pagination mechanism without the total count of items or pages.

Example with SimplePaginateAsync
var context = new ApplicationDbContext();
var products = context.Products;

int pageNumber = 1;
int pageSize = 10;

var paginationResult = await products.SimplePaginateAsync(pageNumber, pageSize);

// paginationResult includes:
// Items: Current page's list of products.
// Page: Current page number.
// PageSize: Number of items per page.

Using CursorPaginateAsync

CursorPaginateAsync is ideal for efficient and stateful pagination, such as infinite scrolling.

Example with CursorPaginateAsync
var context = new ApplicationDbContext();
var products = context.Products.OrderBy(p => p.Id);

int pageSize = 10;
int? currentCursorId = null;

var paginationResult = await products.CursorPaginateAsync(
    p => p.Id, pageSize, currentCursorId, PaginationOrder.Ascending);

// paginationResult includes:
// Items: List of products for the current segment.
// PageSize: Number of items per segment.
// Cursor: Current cursor position.

These examples aim to provide clear and concise guidance for using CorePagination effectively in your applications.

Upcoming Changes

🚀 Version 0.2.0 Update Announcement: We are excited to announce that CorePagination will soon be updated to version 0.2.0, bringing significant improvements and new features. Stay tuned for the release!

Roadmap to Version 1.0

For the upcoming 1.0 release, we are planning to include:

  • Enhanced Validations: Adding guards and validations across methods to ensure robustness and handle nulls more effectively.
  • Configurable Paginators: Introducing stateful paginators with default configuration options.
  • Comprehensive Documentation: Expanding code documentation and providing detailed usage examples in both English and Spanish.
  • NuGet and GitHub Packaging: Making the library easily accessible and distributable through NuGet and GitHub packages.
  • Unit Testing: Strengthening the library with thorough unit tests.
  • Branding: Adding a logo to give CorePagination a unique identity.
  • Continuous Improvement: We are committed to continuously improving the library based on community feedback and evolving needs.

Beyond Version 1.0

  • Version 2.0 and Future Releases: We are already planning ahead for version 2.0 and beyond, focusing on performance benchmarks and testing to ensure CorePagination remains efficient and scalable.

Contributing

Contributions are welcome! If you have ideas for improving the library or have found a bug, feel free to create an issue or submit a pull request.

License

CorePagination is licensed under the Apache License. Feel free to use, modify, and distribute it as you see fit.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.6.0 74 4/25/2024
0.5.0 375 3/15/2024
0.2.1 68 3/6/2024
0.0.2 72 2/26/2024