Example 12: FilterDynamic — Full Dynamic Filter
Uses the same Filter JSON shape as example 7. The difference is the return type: IQueryable / FilterResult<dynamic> instead of IQueryable<T> / FilterResult<T>. Flowed through FilterDynamic<T>, ToListDynamic<T>(Filter), or ToListAsyncDynamic<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<dynamic>)
{
"pageNumber": 1,
"pageSize": 10,
"pageCount": 5,
"totalCount": 42,
"data": [
{ "Id": 7, "Name": "Laptop Pro", "Price": 1299.99, "Category": { "Name": "Electronics" } }
],
"queryString": null
}Note
Note: For
selects, the same projection rules as SelectDynamic apply: non-dotted paths are projected as-is (whole object or collection); dotted paths through reference navigations produce nested dynamic objects (Category: { Name: "..." }); dotted paths through collection navigations use Select lambdas to project individual element fields (Category: { Vendors: [{ Id: … }] }).