Quantix 1.0.1
dotnet add package Quantix --version 1.0.1
NuGet\Install-Package Quantix -Version 1.0.1
<PackageReference Include="Quantix" Version="1.0.1" />
<PackageVersion Include="Quantix" Version="1.0.1" />
<PackageReference Include="Quantix" />
paket add Quantix --version 1.0.1
#r "nuget: Quantix, 1.0.1"
#:package Quantix@1.0.1
#addin nuget:?package=Quantix&version=1.0.1
#tool nuget:?package=Quantix&version=1.0.1
Quantix
A source-generated, AOT-friendly mediator for .NET. Zero runtime reflection, linker-safe, fast.
Quantix is a clean-room, MIT-licensed mediator. It moves every decision a reflection-based mediator makes at runtime — handler discovery, generic closing, dispatch — to compile time, using a Roslyn incremental source generator. The result: no startup assembly scan, no per-call reflection, no trim or Native AOT warnings, and a missing handler reported as a build error rather than a runtime exception.
Why Quantix
- Reflection-free. Handlers, behaviors and dispatch are resolved and emitted at compile time. Nothing scans assemblies; nothing closes generics or invokes methods by reflection.
- Native AOT and trimming clean. Generated code references every handler by its concrete type, so it publishes with no trim or AOT warnings.
- Errors at build time. A missing handler, a duplicate handler, an ambiguous result type —
all are
QTXbuild diagnostics, not production surprises. - Pay for what you use. A message with no pipeline behaviors dispatches straight to its handler, with no chain allocation.
- One package, zero config. Install
Quantix, callAddQuantix(), send messages.
Install
dotnet add package Quantix
Targets net8.0 and net10.0.
Quickstart
Define a message and its handler:
using Quantix;
public sealed record GetWeather(string City) : IQuery<string>;
public sealed class GetWeatherHandler : IQueryHandler<GetWeather, string>
{
public ValueTask<string> Handle(GetWeather query, CancellationToken ct)
=> new($"Sunny in {query.City}");
}
Register Quantix — one line, no assembly scan:
builder.Services.AddQuantix();
Dispatch through IMediator:
app.MapGet("/weather/{city}", (string city, IMediator mediator, CancellationToken ct)
=> mediator.Send(new GetWeather(city), ct));
That is the whole API surface for the common case. There are no marker-interface registrations, no assembly lists, no open-generic registration ceremony.
What you get
- Commands, queries, notifications and streams —
ICommand/ICommand<T>,IQuery<T>,INotification,IStreamRequest<T>, dispatched bySend,PublishandStream. - Pipeline behaviors — closed or open-generic. An open-generic behavior is scoped by its
own generic constraints:
where TRequest : ICommand<TResult>wraps commands and nothing else. - Generic messages — a message type may itself be generic; Quantix discovers each concrete instantiation used in the program and emits a closed dispatch path for it.
- Adaptive dispatch — a type-pattern chain for small message sets, a frozen-dictionary jump table for large ones; the switch point is benchmark-tuned.
- Compile-time diagnostics — the
QTXdiagnostic catalogue turns missing or ambiguous handlers into build errors. - Navigation hints — an analyzer names the handler that runs at each
Send/Publish/Streamcall site. - An opt-in pipeline manifest — set
<QuantixEmitManifest>true</QuantixEmitManifest>to generate a human-readable map of every message, its handler and its behavior chain.
How it works
Quantix ships as a single package containing the public abstractions and a Roslyn incremental
source generator. At build time the generator discovers every handler and behavior, validates
them, and emits two things into your assembly: the QuantixMediator dispatcher and the
AddQuantix() dependency-injection registration. The dependency-injection container only ever
sees closed types, which is what keeps Quantix AOT-clean.
Requirements
- A consuming project on
net8.0ornet10.0. - A C#-capable build (the generator targets
netstandard2.0, so it loads in every modern SDK and IDE).
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
-
net8.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.