PageSort 1.0.3

dotnet add package PageSort --version 1.0.3                
NuGet\Install-Package PageSort -Version 1.0.3                
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="PageSort" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PageSort --version 1.0.3                
#r "nuget: PageSort, 1.0.3"                
#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 PageSort as a Cake Addin
#addin nuget:?package=PageSort&version=1.0.3

// Install PageSort as a Cake Tool
#tool nuget:?package=PageSort&version=1.0.3                

PageSort

What is PageSort

PageSort is a simple .Net Standard library that is built to ease paging, sort and filtering of IQueryable collections. This is the main repository for PageSort and its extensions.

Getting Started

You need to reference the PageSort namespace in your project.

Using PageSort;
Paging Example
Using the IQueryable Extension

collection - collection.Page(1, 20);

The Page IQueryable extension takes the pageNumber and the pageSize. It returns paged collection of the specified source query.

Using the GeneratePaging Method.
var pageQuery = new PageQuery{
    PageNumber = 1,
    PageSize = 20,
};

var collection = new IQueryable<Student>();
var pagedCollection = GeneratePaging(collection, pageQuery);

The GeneratePaging() method takes an IQueryable collection and a PageQuery object. This method returns a PageResult object.

Sorting Example
Using the IQueryable Extension.
var sortedCollection = collection.OrderByProperty(sortProperty);

var sortedCollection = collection.OrderByDescendingProperty(sortProperty);
Page and Sort at ago

You can also use the GeneratePaging Method to perform both paging and sorting Operations on a collection

var pageQuery = new PageQuery{
    PageNumber = 1,
    PageSize = 20,
    SortProperty = "DateOfBirth",
    SortOrder = ListSortDirection.Descending
};

var collection = new IQueryable<Student>();
var pagedCollection = GeneratePaging(collection, pageQuery);
PageResult

Below is an example of a PageResult

{
    CurrentPage = 1,
    PageSize = 20,
    TotalCount = 200,
    TotalPages = 10,
    Collection = collection,
    PreviousPage = true,
    NextPage = true

}
  • CurrentPage is an integer that represents the current page of the collection that is being returned
  • PageSize is the size of the collection that is to be returned per page.
  • TotalCount is the total number of Items in the collection for which paging is done.
  • TotalPages is the total number of pages that can be generated from the collection. This value is dependant on the PageSize value that is passed.
  • Collection is the list of items in the current page.
  • PreviousPage is a boolean that tells whether there are previous pages or not. This is set to false if PageNumber is 1 or the collection can only have one page.
  • NextPage is a boolean that tells whether there are more pages or not. It is set to false if there is only one page, or we are on the last page of the collection

Installing

First, install NuGet. Then, install PageSort from the package manager console:

PM> Install-Package PageSort

You can also install the PageSort Package using the .NET CLI

dotnet add package PageSort

You can also add the package reference to the project file of your project.

<PackageReference Include="PageSort Version="1.0.2" />

Do you have an issue?

If you run into problems, please share it with me via email at stanleybarna@gmail.com

License, e.t.c.

PageSort is Copyright © 2020 Stanley Barnabas Nagwere and other contributors under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • 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.3 2,065 2/3/2021
1.0.2 883 8/5/2019
1.0.1 515 8/5/2019
1.0.0 546 5/6/2019