Typed queries fordata lists in .NET.
Describe a row type once. Search, filters, sort, paging and facets become plain data that serializes to JSON, runs over a list or an IQueryable, and has a URL form that survives a round trip.
Install
dotnet add package Klyroo.Query --prerelease
Copy the command
Klyroo.Query
Typed schema Sortable fields, filters, search fields and defaults are declared with expressions such as c => c.Country!.Name, so there are no field names to mistype.Filter tree Five filter kinds, 13 operators, nested AND/OR groups, and an include-empty flag on a rule.Facets Offset paging, keyset cursor paging with a stable sort, and option counts per filter.Validation Sanitize drops unknown keys, operators the filter does not allow, malformed values and oversized pages before a request reaches your data.
Program.cs
var schema = DataListSchema.For<Customer>(s => s
.Search(c => c.Name, c => c.Email)
.Field(c => c.Age, f => f.Sortable())
.Field(c => c.Status, f => f.Filter(
DataListFilter.Option().WithFacets())));
var state = schema.DefaultState with
{
Search = "a", PageSize = 3,
Sort = [new DataListSort("age", Descending: true)],
Filters = [new FilterRule("status", FilterOperator.Is,
new FilterValue.Text("Active"))],
};
var request = state.ToRequest(facets: [new("status")]);
var page = schema.ExecuteInMemory(customers, request);
var query = DataListStateQuery.ToQuery(state, schema);Search reads the fields you list, here the name and the email. The request carries only the text.
{ "paging": { "type": "offset", "skip": 0, "take": 3 }, "sort": [{ "key": "age", "descending": true }], "filter": { "combinator": "and", "children": [{ "type": "rule", "key": "status", "operator": "is", "value": { "type": "text", "value": "Active" } }] }, "search": { "term": "a" }, "facets": [{ "key": "status" }] }/customers?q=a&ps=3&s=-age&f.status.is=Active
q: the search text s: the sort; a leading - is descending f.status.is: one key per rule, with its operator facets are asked by the request and are not in the address only what differs from the defaults is written
| Customer | Age | Status |
|---|---|---|
| Clara Diaz | 42 | Active |
| Erik Holm | 39 | Active |
| Alice Martin | 34 | Active |
4 customers, showing 3
StatusActive 4Inactive 1
Everything it does
- Typed schema
- Declare sortable fields, filters, search fields, collection fields and defaults with expressions such as
c => c., so there are no field names to mistype and nothing reflects over strings.Country!. Name - Filter tree
- Five filter kinds (text, option, boolean, number, date), 13 operators, nested AND/OR groups, and an include-empty flag on a rule.
- One request, several backends
ExecuteInMemoryruns a request over a collection, andApplyturns the same request intoIQueryableoperators that EF Core translates to SQL.- Paging and facets
- Offset paging, keyset cursor paging with a stable sort (nulls last, row key as the tie-break), and option counts per filter.
- Request validation
Sanitizedrops unknown keys, operators the filter does not allow, malformed values and oversized pages before a request reaches your data.- URL codecs
Datawrites a list state as query keys (List State Query q,p,s,f.) and reads it back without throwing, andstatus QueryCodecsconverts single values.- URL state for Blazor
QueryStatebinds query keys to typed values and records, with history control and links that work in static server rendering.- Trim-safe core
Klyroo.is marked trimmable and AOT compatible, and ships a source-generated JSON context for the wire records.Query. Core
Packages
Klyroo.CoreQuery. Core Schema, request, filter and result model, URL codecs, in-memory executor andIQueryableapplier. No UI dependency.Klyroo.BlazorQuery QueryState,QueryValueand<T> QueryGroupfor Blazor, and the<TRecord> AddKlyrooQueryregistration. Depends onKlyroo..Query. Core -
EfAsync, which runs the queries built byQuery Executor Klyroo.with the async operators of EF Core.Query. Core
Install it, then open the first page.
Change here for the other lines
- Klyroo.UI Accessible Blazor components for the web and .NET MAUI Blazor Hybrid, styled with Tailwind CSS v4
- Klyroo.Query Typed query model, URL state sync, and IQueryable / EF Core execution
- Klyroo.Table Data lists with table and card-grid layouts, filters, selection and actions
- Klyroo.Form Schema-driven forms, validation and wizards
- Klyroo.Dashboard Dashboard controller, filters and Blazor blocks: stats, gauges, charts, tables and feeds
- Klyroo.Display Code highlighting, secret and file list components, media player controls and file preview
- Klyroo.Spreadsheet Import wizard for CSV, TSV and pasted data, with column and value mapping
- Klyroo.Agent Bridge that lets AI agents read and act on Klyroo forms, dashboards and imports
- Klyroo.Hotkey Server-side .NET client for Hotkey cloud browsers, human handoffs and signed webhooks
- Klyroo.Stack
Meta-package, MCP documentation server and
dotnet newtemplates