Dynamic filters, sort, paginate, group, aggregate, set operations for EF Core — driven by JSON.
$ dotnet add package DynamicWhere.ex --version 2.1.0One package. Eleven extension methods. Three composable shapes (Filter, Segment, Summary).
Pass a Condition / ConditionGroup straight from your front-end. No expression trees, no string LINQ.
Filter is a single object that wraps where, order, page, and select projection.
Sum, Average, Count, Min, Max, FirstOrDefault, LastOrDefault — with optional Having.
Union, Intersect, Except across multiple ConditionSets in one Segment query.
Dotted paths through references and collections — auto-wrapped with .Any() where needed.
Built-in thread-safe cache with FIFO / LRU / LFU eviction and six tuned presets.
{
"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 }
}using DynamicWhere.ex.Source;
using DynamicWhere.ex.Classes.Complex;
using DynamicWhere.ex.Classes.Core;
using DynamicWhere.ex.Enums;
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 }
};
FilterResult<Customer> result = await dbContext.Customers.ToListAsync(filter);