brunobritodev / AspNetCore.IQueryable.Extensions

LINQ extensions to help build IQueryAble Expressions
MIT License
159 stars 29 forks source link

Define [QueryOperator] dynamically #22

Closed drma-tech closed 4 months ago

drma-tech commented 1 year ago

@brunobritodev @GedanMagal

Have you ever thought about being able to define the type of filter applied dynamically? like, the user has the filter on the grid, which has all the possible options and he chooses what he wants to use. but it is not feasible for me to create about 10 attributes for each property, because each one needs to have a different query operator. there could be one and I would inform by the query string which one I will use.

ex:

[QueryOperator(Operator = WhereOperator.Dynamic, CaseSensitive = false)]
public string? Name { get; set; }

then, the call https://localhost:7139/api/Supplier?Limit=10&Offset=0&Name=Paul|Contains