Releases: enisn/AutoFilterer
v2.2.0
What's new ? ✨
- Added
DynamicFilter
which is included inAutoFilterer.Dynamics
packace AutoFilterer.Swagger
is supports inner objects for ordering now.
What's changed ? 🔨
- Range is no longer obsolete. It is a useful class.
- Range is refactored. Increased performance for Range filter.
What's fixed ? 🐛
- Fixed case-sensitive match problem for swagger docs
[v2] Advanced Queries
Summary
This release includes:
Multi-Targeting
Changes
- FilterBase logic is changed,
Filterbase now iterates filter object properties instead of target object properties. That provides a little bit performance while generating queries. - Moved all things into CompareToAttribute
CompareToAttribute includes PropertyNames field in. - Added IgnoreFilterAttribute
That ignores properties in filtering - Added CollectionFilterAttribute
This allows to use Any or All method over collections. Much more options will come into this property. - Updated IFilterableType interfaace
Added filterProperty parameter into BuildExpression method and seperated targetProperty and filterProperty.
Sample
- Now Property name/names can be defined via `CompareTo` attribute:
public class BookFilter : FilterBase
{
[CompareTo("Title","Author")]
[StringFilterOptions(StringFilterOption.Contains)]
public string Search { get; set; }
}
Advanced Queries
Summary
This PR includes advanced queries that allow to decide comparison type from client/request sender.
Check it out some examples:
/books?title.contains=thief
/books?category.not=4
/books?price.lte=15
And amazing thing is you can combine:
/books?title.contains=thief&category.not=4&price.lte=15
Also relared with #9
Deprecated
⚠ Range is deprecated and no longer be maintained and will be removed next major version.
New Types
There are 2 new types in this PR. There are OperatorFilter for struct types and StringFilter for strings as its name describes itself :).
OperatorFilter
This filter includes some simple comparisons:
eq
, not
, gt
, gte
, lt
, lte
Implementation
Place **OperatorFilter** to your Filter model:
public class BookFilter : FilterBase
{
public OperatorFilter<int> TotalPage { get; set; }
}
Use ApplyFilter() method as always:
public IList<Book> GetBooks(BookFilter filter)
{
return db.Books.ApplyFilter(filter).ToList();
}
Usage
- You can launch swagger document to see all arguments.
Just try sample request like below to get books which has 300 pages at least.
/books?totalPage.gte=300
And handler controller as always:
[HttpGet]
public IActionResult Get([FromQuery]BookFilter filter)
{
var result = db.Books.ApplyFilter(filter).ToList();
return Ok();
}
StringFilter
This is a simple string filtering option. All options are below:
eq
, not
, equals
, contains
, startsWith
, endsWith
Implementation
- Place **StringFilter** to your Filter model:
public class BookFilter : FilterBase
{
public StringFilter Title { get; set; }
}
Use ApplyFilter() method as always:
public IList<Book> GetBooks(BookFilter filter)
{
return db.Books.ApplyFilter(filter).ToList();
}
Usage
- You can launch swagger document to see all arguments.
-
Just try sample request like below to get books which's title contains thief keyword.
/books?title.contains=thief
-
And handler controller as always:
[HttpGet]
public IActionResult Get([FromQuery]BookFilter filter)
{
var result = db.Books.ApplyFilter(filter).ToList();
return Ok();
}
Nested Filtering Update v1.1
What's New?
Nested filtering is available now! Relation tables can be filtered with nested FilterBase
objects. Let's visit wiki to get more information.
Release v1.0.5
Changes
- This update fixes some issues from last PR #1
Fixes
- Pagination Problem while using ApplyFilter() extension method over IOrderedQueryable types.
Release v1.0.2
What's new?
In this release, pagination feature is included in library with PaginationFilterBase<T>
type.
You can visit here to see usage of pagination filter.
Changes
- Bug Fix for string comparisons
- Added PaginationFilter