"Can you add a filter by…?"
Whenever you show a grid with more than a few rows, your users need to filter it. Usually you don't know exactly how: by customer, by date, by amount, by all three at once. So you guess, add a few filter fields, and wait for the next request.
Let them use EasyQuery and relax. Users add the conditions they need right above the list, press Apply, and the list shows what they asked for.
The whole server side can be one call. MapEasyQuery adds the EasyQuery API, and UseEntity builds the data
model from your entity class and applies the users' filters to your own Entity Framework IQueryable — so
anything you already restrict in that query stays restricted.
No controllers, no SQL: EasyQuery turns the filter into LINQ.
builder.Services.AddEasyQuery();
...
app.MapEasyQuery(options => {
options.Endpoint = "/data-filtering";
options.UseEntity(manager => manager.Services
.GetRequiredService<AppDbContext>()
.Orders
.Include(o => o.Customer)
.AsQueryable());
});
The same scenario as a project you can open in Visual Studio and run on your machine:
Step by step: getting started with ASP.NET Core.
Don't hesitate to contact us; we are eager to assist with any inquiries.