Awesome Open Source
Awesome Open Source

Fop

Filtering, Ordering (Sorting) and Pagination library for .Net Core, ASP.NET Core, C#

For .Net Core developers, Fop serves you quite simple, easy to integrate and extensible Filtering, Ordering (Sorting) and Paging functionality.

Fop Nuget

To see detailed documentation please visit wiki page

Quick Start

Let's see how easy to use Fop

  1. Install Fop NuGet package from here.
PM> Install-Package Fop
  1. Add FopQuery to your get method
[HttpGet]
public async Task<IActionResult> Index([FromQuery] FopQuery request)
{
    var fopRequest = FopExpressionBuilder<Student>.Build(request.Filter, request.Order, request.PageNumber, request.PageSize);

    var (filteredStudents, totalCount) = await _studentRepository.RetrieveStudents(fopRequest);

    return Ok(filteredStudents);
}
  1. ApplyFop from your repository
 public async Task<(List<Student>, int)> RetrieveStudents(IFopRequest request)
 {
     var (filteredStudents, totalCount) = _context.Students.ApplyFop(request);
     return (await filteredStudents.ToListAsync(), totalCount);
 }

Install Fop, Build your object by using FopExpressionBuilder.Build() then ApplyFop() That's All 🤘

More and more detail at here and in Wiki page. Please visit before you decided to not use

Deep Dive

Fop Operators

Supported operators for type are below;

Fop uses these query sign for preparing expression.

Operators Query Sign Int/Long String Char DateTime Guid
Equal == ✔️ ✔️ ✔️ ✔️ ✔️
NotEqual != ✔️ ✔️ ✔️ ✔️ ✔️
GreaterThan > ✔️ ❌ ❌ ✔️ ❌
GreaterOrEqualThan >= ✔️ ❌ ❌ ✔️ ❌
LessThan < ✔️ ❌ ❌ ✔️ ❌
LessOrEqualThan <= ✔️ ❌ ❌ ✔️ ❌
Contains ~= ❌ ✔️ ❌ ❌ ❌
NotContains !~= ❌ ✔️ ❌ ❌ ❌
StartsWith _= ❌ ✔️ ❌ ❌ ❌
NotStartsWith !_= ❌ ✔️ ❌ ❌ ❌
EndsWith |= ❌ ✔️ ❌ ❌ ❌
NotEndsWith !|= ❌ ✔️ ❌ ❌ ❌
Example

api/students/

?Filter=Midterm>10;and

&Order=Midterm;desc

&PageNumber=1

&PageSize=2`

The above expression returns us students whose midterms is more than 10, then order by Midterm descending with page number is 1 and page size is 2.

It works! 🚀 For more about query language click here!

Examples

It works! Perfect!

Works for multiple filter logic as well! 🎉

I don't want to make readme page so crowdy. please visit the wiki page to see more feature of the package

Next Things..

  • LOGO
  • Better unit tests
  • Improved sample

License

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

Contributing

Everyone is welcome to contribute!

Acknowledgments

  • DynamicExpresso It helps me to save my hair pulled down! 🙏 Thanks for the great library. It helps me a lot on Filtering.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C Sharp (278,472) 
Asp Net Core (3,701) 
Filter (1,844) 
Netcore (1,553) 
Sort (758) 
Page (561) 
Sorting (559) 
Filtering (312) 
Order (245) 
Paging (164) 
Related Projects
Advertising 📦 9
All Projects
Application Programming Interfaces 📦 120
Applications 📦 181
Artificial Intelligence 📦 72
Blockchain 📦 70
Build Tools 📦 111
Cloud Computing 📦 79
Code Quality 📦 28
Collaboration 📦 30
Command Line Interface 📦 48
Community 📦 81
Companies 📦 60
Compilers 📦 60
Computer Science 📦 74
Configuration Management 📦 39
Content Management 📦 167
Control Flow 📦 197
Data Formats 📦 77
Data Processing 📦 266
Data Storage 📦 132
Economics 📦 60
Frameworks 📦 198
Games 📦 122
Graphics 📦 103
Hardware 📦 148
Integrated Development Environments 📦 47
Learning Resources 📦 147
Legal 📦 28
Libraries 📦 119
Lists Of Projects 📦 21
Machine Learning 📦 336
Mapping 📦 61
Marketing 📦 15
Mathematics 📦 55
Media 📦 228
Messaging 📦 97
Networking 📦 304
Operating Systems 📦 84
Operations 📦 120
Package Managers 📦 52
Programming Languages 📦 229
Runtime Environments 📦 96
Science 📦 42
Security 📦 375
Social Media 📦 26
Software Architecture 📦 70
Software Development 📦 68
Software Performance 📦 57
Software Quality 📦 127
Text Editors 📦 45
Text Processing 📦 131
User Interface 📦 310
User Interface Components 📦 465
Version Control 📦 29
Virtualization 📦 68
Web Browsers 📦 38
Web Servers 📦 25
Web User Interface 📦 194