DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

Installation

DynamicWhere.ex is published on NuGet. It targets .NET 6+ and plugs into any project that already uses Entity Framework Core.

dotnet CLI

dotnet add package DynamicWhere.ex --version 2.1.0

Package Manager (Visual Studio)

Install-Package DynamicWhere.ex -Version 2.1.0

PackageReference (csproj)

<ItemGroup>
  <PackageReference Include="DynamicWhere.ex" Version="2.1.0" />
</ItemGroup>

Dependencies

DynamicWhere.ex depends on the following packages — restore will pull them automatically. Versions are pinned to the floor; newer compatible releases are picked up by default unless your project locks them down.

PackageVersionWhy
Microsoft.EntityFrameworkCore6.0.22Provides IQueryable<T>, CountAsync, ToListAsync, ToQueryString.
System.Linq.Dynamic.Core1.6.7Enables string-based Select / OrderBy / GroupBy used by the dynamic variants.

Namespaces you'll import

The most common usings:

using DynamicWhere.ex.Source;            // Extension methods
using DynamicWhere.ex.Classes.Core;      // Condition, ConditionGroup, OrderBy, PageBy, ...
using DynamicWhere.ex.Classes.Complex;   // Filter, Segment, Summary
using DynamicWhere.ex.Enums;             // DataType, Operator, Connector, ...
using DynamicWhere.ex.Optimization.Cache.Source; // CacheExpose
using DynamicWhere.ex.Optimization.Cache.Config; // CacheOptions, CacheEvictionStrategy

Verify the install

The fastest sanity check is a one-liner against an existing DbSet:

var count = await db.Customers
    .Where(new Condition
    {
        Sort = 1,
        Field = "Id",
        DataType = DataType.Number,
        Operator = Operator.GreaterThan,
        Values = new List<object> { 0 }
    })
    .CountAsync();
Note
Once that compiles and runs, you're good. Move on to Quick Start for a full filter end-to-end.

Compatibility notes

  • Target framework: .NET 6, .NET 7, .NET 8, .NET 9.
  • EF Core provider: any provider that supports ToQueryString() works for the optional getQueryString: true flag. SQL Server, PostgreSQL (Npgsql), MySQL (Pomelo), and SQLite are all known to work.
  • Database collation: case-insensitive I* operators emit .ToLower() on both sides. See Breaking Changes for performance notes.
  • Enum storage: the Enum data type assumes enums are stored as strings. If you store them as integers, filter using DataType.Number instead.