Klyroo.Query.EntityFrameworkCore
0.1.0-preview.1
See the version list below for details.
dotnet add package Klyroo.Query.EntityFrameworkCore --version 0.1.0-preview.1
NuGet\Install-Package Klyroo.Query.EntityFrameworkCore -Version 0.1.0-preview.1
<PackageReference Include="Klyroo.Query.EntityFrameworkCore" Version="0.1.0-preview.1" />
<PackageVersion Include="Klyroo.Query.EntityFrameworkCore" Version="0.1.0-preview.1" />
<PackageReference Include="Klyroo.Query.EntityFrameworkCore" />
paket add Klyroo.Query.EntityFrameworkCore --version 0.1.0-preview.1
#r "nuget: Klyroo.Query.EntityFrameworkCore, 0.1.0-preview.1"
#:package Klyroo.Query.EntityFrameworkCore@0.1.0-preview.1
#addin nuget:?package=Klyroo.Query.EntityFrameworkCore&version=0.1.0-preview.1&prerelease
#tool nuget:?package=Klyroo.Query.EntityFrameworkCore&version=0.1.0-preview.1&prerelease
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.
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:
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:
DataListStateQuerywrites a list state as query keys (q,p,s,f.status) and reads it back without throwing, andQueryCodecsconverts 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.Query.Coreis 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 everydotnet add packagecommand needs--prerelease. Klyroo.Query.Corehas no other prerequisite: it runs in any .NET 11 app (console, worker, API, MAUI view model).Klyroo.Queryneeds a Blazor app (Blazor Web App or .NET MAUI Blazor Hybrid) andAddKlyrooQuery()inProgram.cs. It works in every render mode; static server rendering cannot navigate, so links carry the state there.Klyroo.Query.EntityFrameworkCoreneeds 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.Corehas no platform restriction. It is markedIsAotCompatibleandIsTrimmable, 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.Queryworks 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 declaresbrowser,ios,android,maccatalystandwindowsas supported platforms for .NET MAUI Blazor Hybrid; this repository does not build or test a MAUI app.Klyroo.Query.EntityFrameworkCoredepends onMicrosoft.EntityFrameworkCore10.0.15 or later. The tests of this repository run theIQueryableapplier 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
| Product | Versions 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. |
-
net10.0
- Klyroo.Query.Core (= 0.1.0-preview.1)
- Microsoft.EntityFrameworkCore (>= 10.0.0)
-
net11.0
- Klyroo.Query.Core (= 0.1.0-preview.1)
- Microsoft.EntityFrameworkCore (>= 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 35 | 11/29/2026 |
| 0.1.0-preview.1 | 36 | 11/29/2026 |