We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This feature aims to generate an expression for .Select() Linq method.
.Select()
See usage example for better understanding:
public class Book { public string Name { get; set; } public int TotalPage { get; set; } public DateTime CreateDate { get; set; } public virtual ICollection<BookOrder> BookOrders { get; set; } }
public class BookFilterDto : SelectorFilterBase<BookDto> { [ToLowerContainsComparison] public string Name { get; set; } public Range<int> TotalPage { get; set; } public Range<DateTime> CreateDate { get; set; } }
public class BookDto { [From("Name")] public string Title { get; set; } public int TotalPage { get; set; } public DateTime CreateDate { get; set; } [Count("BookOrders")] public int SellCount { get; set; } [Sum("BookOrders.Price")] public float TotalSoldPrice { get; set; } }
As default, SelectorFilterBase should override ApplyFilter() method, so calling ApplyFilter method will work.
SelectorFilterBase
ApplyFilter()
[HttpGet] public IActionResult GetBooks([FromQuery] BookFilterDto filter) { var query = db.Books.ApplyFilter(filter); // IQueryable<BookDto> return Ok(query.ToList()); }
[HttpGet] public IActionResult GetBooks([FromQuery] BookFilterDto filter) { var query = db.Books.ApplySelector(filter) // IQueryable<BookDto> .Where(x => x.TotalSoldPrice > 299.95); // If db provider supports. return Ok(query.ToList()); }
The text was updated successfully, but these errors were encountered:
This might be useful: https://stackoverflow.com/questions/12701737/expression-to-create-an-instance-with-object-initializer/12705338#12705338
Sorry, something went wrong.
Dynamic Select is not compatible with Open API 3.0 standards. This is the main purpose of AutoFilterer. Only static select support can be provided.
enisn
No branches or pull requests
Summary
This feature aims to generate an expression for
.Select()
Linq method.Declaration
See usage example for better understanding:
Usage
As default,
SelectorFilterBase
should overrideApplyFilter()
method, so calling ApplyFilter method will work.As default,
SelectorFilterBase
should overrideApplyFilter()
method, so calling ApplyFilter method will work.Structure
TODO List
The text was updated successfully, but these errors were encountered: