Klyroo.Query 0.1.0-preview.2

This is a prerelease version of Klyroo.Query.
dotnet add package Klyroo.Query --version 0.1.0-preview.2
                    
NuGet\Install-Package Klyroo.Query -Version 0.1.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Klyroo.Query" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Klyroo.Query" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Klyroo.Query" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Klyroo.Query --version 0.1.0-preview.2
                    
#r "nuget: Klyroo.Query, 0.1.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Klyroo.Query@0.1.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Klyroo.Query&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Klyroo.Query&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

Klyroo.Query

A typed query model for data lists in .NET. It describes search, filter, sort, paging and facet requests, gives them a URL form, and runs them over in-memory collections or Entity Framework Core, in Blazor, .NET MAUI Blazor Hybrid or an API.

CI NuGet License: MIT

You describe a row type once, with a schema built from lambda expressions. A request (filter tree, sort, search, paging, facets) is plain data that serializes to JSON, runs against an in-memory list or an IQueryable with the same operators, and has a URL form that survives a round trip. The engine, Klyroo.Query.Core, has no UI or ASP.NET Core dependency and runs wherever .NET 11 runs; Klyroo.Query adds QueryState, which keeps Blazor components in sync with the query string.

Features

  • Typed schema: declare sortable fields, filters, search fields, collection fields and defaults with expressions such as c => c.Country!.Name, so there are no field names to mistype and nothing reflects over strings.
  • 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: ExecuteInMemory runs a request over a collection, and Apply turns the same request into IQueryable operators 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: Sanitize drops unknown keys, operators the filter does not allow, malformed values and oversized pages before a request reaches your data.
  • URL codecs: DataListStateQuery writes a list state as query keys (q, p, s, f.status) and reads it back without throwing, and QueryCodecs converts single values.
  • URL state for Blazor: QueryState binds query keys to typed values and records, with history control and links that work in static server rendering.
  • Trim-safe core: Klyroo.Query.Core is marked trimmable and AOT compatible, and ships a source-generated JSON context for the wire records.

Packages

Package Description
Klyroo.Query.Core Schema, request, filter and result model, URL codecs, in-memory executor and IQueryable applier. No UI dependency.
Klyroo.Query QueryState, QueryValue<T> and QueryGroup<TRecord> for Blazor, and the AddKlyrooQuery registration. Depends on Klyroo.Query.Core.
Klyroo.Query.EntityFrameworkCore EfAsyncQueryExecutor, which runs the queries built by Klyroo.Query.Core with the async operators of EF Core.

Prerequisites

To use the library in an app:

  • The .NET 11 SDK, and an app that targets net11.0. The packages are prereleases, so every dotnet add package command needs --prerelease.
  • Klyroo.Query.Core has no other prerequisite: it runs in any .NET 11 app (console, worker, API, MAUI view model).
  • Klyroo.Query needs a Blazor app (Blazor Web App or .NET MAUI Blazor Hybrid) and AddKlyrooQuery() in Program.cs. It works in every render mode; static server rendering cannot navigate, so links carry the state there.
  • Klyroo.Query.EntityFrameworkCore needs Entity Framework Core 10.0.15 or later and a provider for your database.

To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.json). See Contributing.

Installation

dotnet add package Klyroo.Query.Core --prerelease                  # the engine, for any .NET 11 project
dotnet add package Klyroo.Query --prerelease                       # adds QueryState for Blazor (brings Klyroo.Query.Core)
dotnet add package Klyroo.Query.EntityFrameworkCore --prerelease   # optional, for EF Core

In a Blazor app, register the service and import the namespace. There is no stylesheet to add.

using Klyroo.Query;

builder.Services.AddKlyrooQuery();
@using Klyroo.Query

Quick start

Headless first. This runs in a console app, a worker or an API, with only Klyroo.Query.Core installed.

using Klyroo.Query;

Customer[] customers =
[
    new(1, "Alice Martin", "alice@example.com", CustomerStatus.Active, 34),
    new(2, "Bruno Costa", "bruno@example.com", CustomerStatus.Inactive, 51),
    new(3, "Dana Lee", "dana@example.com", CustomerStatus.Active, 28),
    new(4, "Clara Diaz", "clara@example.com", CustomerStatus.Active, 42),
    new(5, "Erik Holm", "erik@example.com", CustomerStatus.Active, 39),
];

var schema = DataListSchema.For<Customer>(s => s
    .RowKey(c => c.Id)
    .Search(c => c.Name, c => c.Email)
    .Field(c => c.Name, f => f.Sortable())
    .Field(c => c.Age, f => f.Sortable().Filter(DataListFilter.Number(min: 0)))
    .Field(c => c.Status, f => f.Filter(DataListFilter.Option()))
    .DefaultSort(c => c.Name));

// Active customers whose name or email contains "ar", oldest first, 25 per page.
var request = new DataListRequest(
    new DataListPaging.Offset(Skip: 0, Take: 25),
    [new DataListSort("age", Descending: true)],
    DataListFilterGroup.And(new FilterRule("status", FilterOperator.Is, new FilterValue.Text("Active"))),
    new DataListSearch("ar"));

DataListResult<Customer> page = schema.ExecuteInMemory(customers, request);

Console.WriteLine($"{page.TotalCount} customers");
foreach (var customer in page.Items)
    Console.WriteLine($"{customer.Name}, {customer.Age}");

public enum CustomerStatus { Active, Inactive }

public sealed record Customer(int Id, string Name, string Email, CustomerStatus Status, int Age);

It prints:

2 customers
Clara Diaz, 42
Alice Martin, 34

Then Blazor. This component binds the q key of the URL to a search box. A link to /customers?q=dan, the Back button and the address bar all change what it shows, and an empty search leaves no key in the URL. It needs an interactive render mode.

@namespace Samples
@implements IDisposable
@inject QueryState Query

<input type="search" placeholder="Search customers" value="@_search.Value" @oninput="OnInput" />

<ul>
    @foreach (var customer in Matches())
    {
        <li>@customer.Name</li>
    }
</ul>

@code {
    private QueryValue<string> _search = default!;

    protected override void OnInitialized()
    {
        // The default value ("") is left out of the URL. RendererInfo says whether this render can navigate.
        _search = Query.Bind("q", QueryCodecs.String, "", RendererInfo);
        _search.Changed += OnSearchChanged;
    }

    private void OnInput(ChangeEventArgs e) => _search.Value = e.Value?.ToString() ?? "";

    // Changed is raised on the thread that changed the URL, so go through InvokeAsync before rendering.
    private void OnSearchChanged() => _ = InvokeAsync(StateHasChanged);

    private IEnumerable<Customer> Matches() =>
        SampleData.Customers.Where(c => c.Name.Contains(_search.Value, StringComparison.OrdinalIgnoreCase));

    public void Dispose()
    {
        _search.Changed -= OnSearchChanged;
        _search.Dispose();
    }
}

Documentation

Getting started Step-by-step first integration
Guides Task-oriented recipes
Concepts How the library works
Platforms Render modes, .NET MAUI, NativeAOT
API reference Every public type and member
FAQ Troubleshooting and limitations

Compatibility

  • .NET 11 SDK. All three packages target net11.0.
  • Klyroo.Query.Core has no platform restriction. It is marked IsAotCompatible and IsTrimmable, and a console app using the in-memory executor, the URL codecs and the JSON context was published and run with NativeAOT on linux-x64.
  • Klyroo.Query works in Blazor Static SSR, Interactive Server, WebAssembly and Auto. Static SSR cannot navigate, so writes are ignored there and links (HrefWith) carry the state instead. It declares browser, ios, android, maccatalyst and windows as supported platforms for .NET MAUI Blazor Hybrid; this repository does not build or test a MAUI app.
  • Klyroo.Query.EntityFrameworkCore depends on Microsoft.EntityFrameworkCore 10.0.15 or later. The tests of this repository run the IQueryable applier on SQLite.

Klyroo ecosystem

Klyroo is a family of independent .NET libraries that compose. Each one has its own repository, versions and releases.

Library Description
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 new templates

Contributing

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Klyroo.Query:

Package Downloads
Klyroo.Table

Klyroo Table for Blazor Web and .NET MAUI Hybrid: data lists with table and card-grid layouts, filters, selection, actions, grouping, trees and summary rows.

Klyroo.Stack

Umbrella meta-package for the entire Klyroo ecosystem (UI, Query, Table, Form, Dashboard, Display, Spreadsheet, Agent) for Blazor Web and .NET MAUI Hybrid.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 34 11/29/2026
0.1.0-preview.1 40 11/29/2026