Shorpy 1.1.0

dotnet add package Shorpy --version 1.1.0
                    
NuGet\Install-Package Shorpy -Version 1.1.0
                    
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="Shorpy" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shorpy" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Shorpy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Shorpy --version 1.1.0
                    
#r "nuget: Shorpy, 1.1.0"
                    
#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.
#addin nuget:?package=Shorpy&version=1.1.0
                    
Install Shorpy as a Cake Addin
#tool nuget:?package=Shorpy&version=1.1.0
                    
Install Shorpy as a Cake Tool

Shorpy

SHORPY CI

NuGet Version

GitHub

Shorpy is a powerful and easy-to-use .NET library that provides seamless dynamic Pagination, Searching, and Sorting for applications using Entity Framework Core, ASP.NET Core WebAPI, and written in C#. It aims to simplify data handling and improve performance by offering efficient querying mechanisms.

Checkout our page

📦 Installation

Install via NuGet Package Manager:

Install-Package Shorpy

Or via .NET CLI:

dotnet add package Shorpy

🔧 Features

  • Dynamic Pagination: Effortlessly handle large datasets with automatic page splitting.
  • 🔍 Search Filtering: Apply search criteria dynamically across multiple columns.
  • 🔄 Sorting: Enable sorting by various properties in ascending or descending order.
  • 📚 Entity Framework Core Integration: Designed to work seamlessly with EF Core queries.
  • 🌐 ASP.NET Core WebAPI Support: Simple integration with WebAPI controllers.

🚀 Getting Started

1. Configure Your SnSAbles and Includables

In your application, create SnSAble (Search and Sortables) and Includables for the Entities you want to paginate.

Eg: Assume you have a two entities in your Context. Namely, Employee and Department. With each Employee belonging to a single Department

Your SnSAble for the Employee entity will look like this.

using System.Linq.Expressions;
using Shorpy.Interfaces;

using type = Expression<Func<Employee, object>>;
public class SnSEmployee: ISnSAble
{
    public static readonly type Name = e=>e.Name;
}

Your Includable for the Employee entity will look like this.

using System.Linq.Expressions;
using Shorpy.Interfaces;

using type = Expression<Func<Employee, object>>;
public class IncEmployee: IIncludable
{
    public static readonly type Department = e=>e.DepartmentNavigation;
}

2. Handle a paginate request from your controller and let the front-end go nuts!

using Shorpy.DTOs;
using Shorpy.Paginate;
.....
[HttpPost]
public virtual async Task<IActionResult> Paginate(PaginateModel pm)
{
    // you must pass your DBContext to the paginate function
    var paginatedObj = await Paginate<Employee, SnSEmployee, IncEmployee>.PaginateWithTracking(_dbcontext, pm);

    return Ok(paginatedObj);
}

📌 Usage

Request Example

curl -X POST /api/employees/paginate \
-H "Content-Type: application/json" \
-d '{
    "search": [
        {
            "field": "name",
            "value": "Tim",
            "method": "equal",
        }
    ],
    "include": ['Department'],
    "limit": 10,
    "offset":0
}'

Supported search methods:

  • equal
  • gt
  • lt
  • notequal
  • like
  • wherein
  • wherepartiallyin

Response Example

{
  "values": [
    {
      "id": 1,
      "name": "Tim",
      "department": 1,
      "telephone": "000-0000-0000"
    }
  ],
  "total": 1
}

🔨 Contributing

Contributions are welcome! Please submit a pull request or open an issue for discussion.


📃 License

This project is licensed under the MIT License - see the LICENSE file for details.


💬 Support

If you have any questions or need help, feel free to open an issue or reach out.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
1.1.0 116 3/21/2025
1.0.1 137 3/17/2025
1.0.0 125 3/16/2025
0.0.1 85 3/14/2025