Skip to content

BitzArt/Pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pagination

Tests

Overview

This Pagination NuGet package provides efficient pagination capabilities for your C# projects, enabling you to display large data sets conveniently.

Installation

Use with IEnumerable

To use this package with IEnumerable collections, follow these steps:

  1. Install the package using the .NET CLI:
    dotnet add package BitzArt.Pagination
    
  2. Use it by calling the ToPage method on your collections:
    var page = yourEnumerable.ToPage(offset, limit);

Use with Entity Framework Core

For Entity Framework Core projects, you can easily integrate the Pagination package:

  1. Install the package:
    dotnet add package BitzArt.Pagination.EntityFrameworkCore
    
  2. Assuming you have a DbContext with a DbSet of your entity type:
    public class YourDbContext : DbContext
    {
        public DbSet<SomeEntity> Items { get; set; }
        // ...
    }
  3. Utilize the ToPageAsync method provided by the package to create paged results:
    var dbContext = new YourDbContext();
    var paginatedResult = await dbContext.Items.ToPageAsync(offset, limit);

Benefits

  • Simplifies the process of paginating data in your application.
  • Optimized for performance and memory efficiency.
  • Compatible with various data sources.
  • Ideal for scenarios where you need to display a portion of a large dataset at a time.

About

A lightweight library to easily create pages of items. Works with (or without) EF Core to paginate db requests.

Topics

Resources

License

Stars

Watchers

Forks

Languages