Quick Start
From install to working dynamic filter in under two minutes. We'll send a JSON body from the front-end and apply it to an EF Core DbSet<Customer>.
1. Add the namespaces
using DynamicWhere.ex.Source;
using DynamicWhere.ex.Classes.Complex;
using DynamicWhere.ex.Classes.Core;
using DynamicWhere.ex.Enums;2. Build a Filter
A Filter wraps four optional parts: where, select, order, and page.
var filter = new Filter
{
ConditionGroup = new ConditionGroup
{
Connector = Connector.And,
Conditions = new List<Condition>
{
new Condition
{
Sort = 1,
Field = "Name",
DataType = DataType.Text,
Operator = Operator.IContains,
Values = new List<object> { "john" }
}
}
},
Orders = new List<OrderBy>
{
new OrderBy
{
Sort = 1,
Field = "CreatedAt",
Direction = Direction.Descending
}
},
Page = new PageBy { PageNumber = 1, PageSize = 10 }
};3. Apply it to a DbSet
FilterResult<Customer> result = await dbContext.Customers.ToListAsync(filter);You get back a strongly-typed FilterResult<T>:
Console.WriteLine($"page {result.PageNumber} of {result.PageCount}");
Console.WriteLine($"{result.TotalCount} total matches");
foreach (var c in result.Data)
{
Console.WriteLine($"- {c.Name}");
}4. Drive it from JSON
Same filter, expressed as a JSON body your client can POST:
{
"conditionGroup": {
"connector": "And",
"conditions": [
{
"sort": 1,
"field": "Name",
"dataType": "Text",
"operator": "IContains",
"values": ["john"]
}
],
"subConditionGroups": []
},
"orders": [
{ "sort": 1, "field": "CreatedAt", "direction": "Descending" }
],
"page": { "pageNumber": 1, "pageSize": 10 }
}And a minimal ASP.NET Core endpoint that consumes it:
app.MapPost("/customers/search", async (Filter filter, AppDbContext db) =>
{
var result = await db.Customers.ToListAsync(filter);
return Results.Ok(result);
});That's the whole story
Front-end → JSON →
Filter → .ToListAsync(filter) → paginated FilterResult<Customer>.Response shape
{
"pageNumber": 1,
"pageSize": 10,
"pageCount": 5,
"totalCount": 42,
"data": [
{ "id": 7, "name": "John Doe", "createdAt": "2025-09-14T12:31:00Z" }
],
"queryString": null
}Set getQueryString: true to also receive the generated SQL — useful in development.
var result = await db.Customers.ToListAsync(filter, getQueryString: true);
Console.WriteLine(result.QueryString);What's next?
- Filter → all four options in detail.
- Operator reference → every supported comparison.
- JSON Cookbook → 13 copy-pasteable examples covering every extension method.
- Segment → when you need UNION / INTERSECT / EXCEPT.
- Summary → when you need GROUP BY + aggregations.