Filter
A Filter is the most common top-level shape. It combines filtering, projection, ordering, and pagination in a single object, and is the input to ToListAsyncFilter and its dynamic / sync siblings.
Properties
| Property | Type | Description |
|---|---|---|
ConditionGroup | ConditionGroup? | Optional where-clause. |
Selects | List<string>? | Optional field projection (like SQL SELECT col1, col2). |
Orders | List<OrderBy>? | Optional sort criteria. |
Page | PageBy? | Optional pagination. |
Order of operations
Internally the pipeline is
where → order → page → select. Ordering and paging run on the full entity, then projection is applied to the trimmed page — so you can sort by a field you don't include in Selects.C# example
var filter = new Filter
{
ConditionGroup = new ConditionGroup
{
Connector = Connector.And,
Conditions = new List<Condition>
{
new Condition
{
Sort = 1,
Field = "IsActive",
DataType = DataType.Boolean,
Operator = Operator.Equal,
Values = new List<object> { true }
}
}
},
Selects = new List<string> { "Id", "Name", "Email" },
Orders = new List<OrderBy>
{
new OrderBy { Sort = 1, Field = "CreatedAt", Direction = Direction.Descending }
},
Page = new PageBy { PageNumber = 1, PageSize = 25 }
};
FilterResult<Customer> result = await dbContext.Customers.ToListAsync(filter);JSON example
{
"conditionGroup": {
"connector": "And",
"conditions": [
{ "sort": 1, "field": "IsActive", "dataType": "Boolean", "operator": "Equal", "values": [true] }
],
"subConditionGroups": []
},
"selects": ["Id", "Name", "Email"],
"orders": [
{ "sort": 1, "field": "CreatedAt", "direction": "Descending" }
],
"page": { "pageNumber": 1, "pageSize": 25 }
}See also
- FilterResult<T> → the return shape.
- ToListAsyncFilter →
- ToListAsyncDynamicFilter → for projection to
dynamic. - Filter example →