Example 7: Filter — Typed
A Filter bundles a where group, a select list, ordering, and pagination — then flows through Filter<T>, ToList<T>(Filter) or ToListAsync<T>(Filter).
Request
{
"conditionGroup": {
"connector": "And",
"conditions": [
{
"sort": 1,
"field": "Price",
"dataType": "Number",
"operator": "GreaterThan",
"values": ["50"]
},
{
"sort": 2,
"field": "Category.Name",
"dataType": "Text",
"operator": "IEqual",
"values": ["electronics"]
}
],
"subConditionGroups": []
},
"selects": ["Id", "Name", "Price", "Category.Name"],
"orders": [
{ "sort": 1, "field": "Price", "direction": "Descending" }
],
"page": {
"pageNumber": 1,
"pageSize": 10
}
}Response shape (FilterResult<Product>)
{
"pageNumber": 1,
"pageSize": 10,
"pageCount": 5,
"totalCount": 42,
"data": [
{ "id": 7, "name": "Laptop Pro", "price": 1299.99, "category": { "name": "Electronics" } }
],
"queryString": null
}Note
Set
getQueryString: true on the extension method to populate queryString with the generated SQL — useful in development.Related
- Filter class
- FilterResult class
- FilterDynamic example — same shape returning
FilterResult<dynamic>.