Skip to content
FlexQuery.NET
v4 — typed DTOs, expand trees, keyset pagination

Dynamic querying for .NET APIs

FlexQuery.NET turns query parameters into secure, server-side expression trees — filtering, sorting, paging, projection, and aggregates in a single line, with EF Core or Dapper.

GET /api/customers
    ?filter=Status:eq:Active
    &sort=LastName:asc
    &select=Id,FirstName,Email
    &page=1&pageSize=20

query parameters → FlexQuery pipeline → SQL expression tree

Up and running in minutes

Three steps from NuGet to a production-grade query endpoint.

1

Install

Add the core package and your provider package from NuGet.

Shell
dotnet add package FlexQuery.NET.EntityFrameworkCore
2

Configure

Set global defaults once at startup - then never think about them again.

C#
FlexQueryCore.Configure(options =>
{
    options.DefaultPageSize = 20;
    options.MaxPageSize = 1000;
});
3

Query

Bind FlexQueryParameters and execute. That is the whole endpoint.

C#
var result = await db.Customers
    .AsNoTracking()
    .FlexQueryAsync(parameters,
        cancellationToken: ct);

Everything a query API needs

One pipeline from query string to SQL — validated, governed, and observable.

Why FlexQuery?

Every list endpoint needs filtering, sorting, paging, projection, and include logic — plus validation for all of it. FlexQuery centralizes that repetition into one governed pipeline.

Without FlexQuery

  • Custom filter parsing in every endpoint
  • Ad-hoc sorting and pagination logic
  • Projection and include code repeated per feature
  • Validation re-implemented — or forgotten
  • Multiple endpoints, or one overloaded query object

With FlexQuery

  • One bind and one call per endpoint
  • Query string → validated expression tree → SQL
  • Defaults and governance configured once, globally
  • Identical query behavior on EF Core and Dapper
var result = await db.Customers
    .FlexQueryAsync(parameters, cancellationToken: ct);

From query string to SQL

Nothing is string-matched into LINQ at runtime. Requests become governed, typed expression trees before they ever reach your database.

  1. 01HTTP query

    ?filter=…&sort=…&page=…

  2. 02Parser

    Query string → query model

  3. 03Governance

    Allow-lists, roles, limits

  4. 04Expression tree

    Typed IQueryable composition

  5. 05Provider

    EF Core or Dapper

  6. 06Database

    Parameterized SQL

See the full execution pipeline in the docs.

Providers & integrations

Works with your stack — data access, UI grids, and API documentation.

Build your first query in five minutes

Follow the quick-start guide and ship a dynamic query endpoint today.

Start building
Shell
dotnet add package FlexQuery.NET.EntityFrameworkCore