DynamicWhere.ex
DynamicWhere.exv2.1.0·docs
v2.1.0 released · heterogeneous values, six cache presets

JSON-driven queries.
For EF Core. Done right.

Dynamic filters, sort, paginate, group, aggregate, set operations for EF Core — driven by JSON.

terminal
$ dotnet add package DynamicWhere.ex --version 2.1.0
What's inside

Everything you need to query dynamically

One package. Eleven extension methods. Three composable shapes (Filter, Segment, Summary).

JSON-driven filters

Pass a Condition / ConditionGroup straight from your front-end. No expression trees, no string LINQ.

Sort, page & project

Filter is a single object that wraps where, order, page, and select projection.

GroupBy + aggregations

Sum, Average, Count, Min, Max, FirstOrDefault, LastOrDefault — with optional Having.

Set operations

Union, Intersect, Except across multiple ConditionSets in one Segment query.

Nested navigation

Dotted paths through references and collections — auto-wrapped with .Any() where needed.

Reflection cache

Built-in thread-safe cache with FIFO / LRU / LFU eviction and six tuned presets.

In practice

From front-end JSON to materialized result

Front-end / API bodyJSON
{
  "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 }
}
Back-end / C# usageC#
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);
Pick your path

Jump straight to what you need