This Pagination NuGet package provides efficient pagination capabilities for your C# projects, enabling you to display large data sets conveniently.
To use this package with IEnumerable collections, follow these steps:
-
Install the package using the .NET CLI:
dotnet add package BitzArt.Pagination
-
Use it by calling the ToPage method on your collections:
var page = yourEnumerable.ToPage(offset, limit);
For Entity Framework Core projects, you can easily integrate the Pagination package:
-
Install the package:
dotnet add package BitzArt.Pagination.EntityFrameworkCore
-
Assuming you have a DbContext with a DbSet of your entity type:
public class YourDbContext : DbContext { public DbSet<SomeEntity> Items { get; set; } // ... }
-
Utilize the ToPageAsync method provided by the package to create paged results:
var dbContext = new YourDbContext(); var paginatedResult = await dbContext.Items.ToPageAsync(offset, limit);
- 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.