Data Sorting & Pagination Models and Operations
H.Necessaire offers data pagination models and operations.
dotnet add package H.Necessaire
Presenting data in a paginated manner comes into play extremely often in any project. Therefore H.Necessaire comes with data models and operations for such scenarios so that it's uniform across modules and projects.
Page Model
Sort Filter Model
class SortFilter
{
string By
SortDirection Direction
enum SortDirection
{
Ascending = 0
Descending = 1
}
}
interface ISortFilter
{
SortFilter[] SortFilters
}
abstract class SortFilterBase : ISortFilter
{
abstract string[] ValidSortNames
}
Page Filter Model
This model is to be used and interpreted by data providers
class PageFilter
{
int PageIndex
int PageSize
}
interface IPageFilter
{
PageFilter PageFilter
}
Page Model Construction help static methods
Page<T>.For(IPageFilter pagefilter, long allCount, params T[] content)
Page<T>.Single(params T[] content)
Page<T>.Empty(int pageIndex = 0, int pageSize = 0, int totalNumberOfPages = 1)
Limited Enumerable model
The limited data stream model can be implemented and used by various data providers to be able to construct a page of data
interface ILimitedEnumerable<T> : IEnumerable<T>
{
int Offset
int Length
long TotalNumberOfItems
}
View full models on GitHub: