AutoFilterer is a mini filtering framework library for dotnet. The main purpose of the library is to generate LINQ expressions for Entities over DTOs automatically. Creating queries without writing any expression code is the most powerful feature that is provided. The first aim of AutoFilterer is to be compatible with Open API 3.0 Specifications, unlike oData & GraphQL.
You can check Documentation for getting started. |
- Install
AutoFilterer
NuGet package from here.
Vsit visit documentation to learn how to use AutoFilterer.
A quick example is presented below. Reading documentation is highly recommended for detailed features.
- Create a filter model and make sure property names match to Entity properties.
public class ProductFilter : PaginationFilterBase
{
public Range<double> Price { get; set; }
[ToLowerContainsComparison]
public string Name { get; set; }
[StringFilteringOptions(StringFilterOption.Equals)]
public string Locale { get; set; }
}
public IActionResult GetProducts([FromQuery]ProductFilter filter)
{
var products = db.Products.ApplyFilter(filter).ToList();
return Ok(products);
}
Don't forget to visit Wiki for better understanding of usage.
All parameters support OpenAPI 3.0 Specifications 👍
Improve your swagger documentation via using AutoFilterer.Swagger
AutoFilterer.Generators aims to generate filter objects from entities automatically via using dotnet source generators.
Visit documentation of Generators
See Benchmark Results from here