Rask.Cqrs
0.23.0
See the version list below for details.
dotnet add package Rask.Cqrs --version 0.23.0
NuGet\Install-Package Rask.Cqrs -Version 0.23.0
<PackageReference Include="Rask.Cqrs" Version="0.23.0" />
<PackageVersion Include="Rask.Cqrs" Version="0.23.0" />
<PackageReference Include="Rask.Cqrs" />
paket add Rask.Cqrs --version 0.23.0
#r "nuget: Rask.Cqrs, 0.23.0"
#:package Rask.Cqrs@0.23.0
#addin nuget:?package=Rask.Cqrs&version=0.23.0
#tool nuget:?package=Rask.Cqrs&version=0.23.0
Rask.Cqrs
Source-generated, reflection-free CQRS / mediator for .NET. Structure your app as queries, commands and notifications, and dispatch them through a single injectable interface — with every handler wired at compile time, so there is no runtime reflection and no assembly scanning. It publishes clean under the WASM/AOT trimmer.
Standalone: the only dependency is Microsoft.Extensions.DependencyInjection.Abstractions. You do
not need the rest of Rask to use it.
Install
dotnet add package Rask.Cqrs
Use
Define messages and their handlers:
public sealed record GetUser(int Id) : IQuery<User>;
public sealed class GetUserHandler(AppDb db) : IQueryHandler<GetUser, User>
{
public Task<User> HandleAsync(GetUser q, CancellationToken ct) => db.Users.FindAsync(q.Id, ct);
}
Register once, then dispatch — the response type is inferred:
builder.Services.AddRaskCqrs();
// ...
var user = await dispatcher.QueryAsync(new GetUser(42)); // returns User
ICommand / ICommand<TResult> dispatch the same way; INotification fans out to every handler
via PublishAsync.
Pipeline behaviors
Cross-cutting concerns (logging, validation, transactions, caching) are decorators — implement
IPipelineBehavior<TRequest, TResult> and register it. Behaviors run in registration order, the
first-registered wrapping outermost.
Notes
- Reflection-free / trim-safe — a Roslyn generator emits the handler registry via a
[ModuleInitializer]; nothing is discovered at runtime. - Host-agnostic — the same
AddRaskCqrs()works on a Rask Server or WASM host, or any plain .NET app.
Full documentation: https://github.com/pal-tamas/rask/blob/main/docs/cqrs.md
| 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
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.12)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Rask.Wire (>= 0.23.0)
-
net11.0
- Rask.Wire (>= 0.23.0)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on Rask.Cqrs:
| Package | Downloads |
|---|---|
|
Rask.Wasm
The Rask browser host: runs a Rask app's C# components client-side on .NET WebAssembly, with the client halves of the batteries — the mediator and query cache, remote dispatch, accounts, validation and the component kit — on by default. Ships the JS boot scripts, the page shell, and the MSBuild integration that stages them into the published bundle — and, opted in, prerenders every route to static HTML with a sitemap.xml at publish, so a static host serves real pages to visitors and crawlers. Depends on Rask, the shared core. |
|
|
Rask.Server
The ASP.NET host for Rask, a full-stack .NET web framework, with every battery: database (SQLite, PostgreSQL or SQL Server, picked by Rask:Database:Provider), mediator and query cache, accounts, background jobs, transactional email, cache, file storage, outbox, operator dashboard, durable logs, Web Push, SQLite snapshots and continuous backup. Renders Rask components with live updates over a WebSocket. RaskApp.Create(args).Run<App>() is the whole Program.cs; app.Configure(c => c.Jobs.Off()) is how an app does without one. Depends on Rask, the shared core. |
|
|
Rask.Data
A .NET data layer for Entity Framework Core apps where you declare DDD aggregates and nothing else: no DbContext class, no DbSet property, no IEntityTypeConfiguration, no registration, and no IDbContextFactory injected to read a row. `Entity<TId>` carries Id and audit timestamps, and `Aggregate<TId>` adds a Version concurrency token, domain events and opt-in soft delete (`Deletes = Deletion.Soft`); a source generator builds the EF model from every one it finds, so nothing is reflected and a trimmed publish cannot drop a table. Value objects need no marker and map as EF complex types. Reads go through a generated read face (`Product.Read.Where(...)`, `Product.Read.Search(text)`, `Product.Read.AsQueryable()`) via C# 14 static extension members, always untracked, each on its own short-lived context. The generator also writes a nullable form model, `ProductModel`, for every aggregate, with its defaults, `ToModel()` and validation attributes; the generated writes (Product.CreateAsync(model), Product.UpdateAsync(id, model), Product.DeleteAsync(id)) take it, with an optional lambda for values the form does not carry and an optional DbContext to join; anything richer is plain EF Core through an injected context. Strongly-typed ids get a generated value converter, mapping rules live in a static Configure on the type, and interceptors drive audit stamps, opt-in soft delete, multi-tenancy (`Tenancy.PerTenant`, the tenant read from the signed-in user), optimistic concurrency and after-commit domain-event publication through Rask.Cqrs. `Current.UserId` answers who is signed in from code with nothing injected. Ranked full-text search is declared with `HasFullTextSearch` and read with `Product.Read.Search(text)`, on SQLite, PostgreSQL and in the browser. A class that does not derive from Entity stays ordinary EF Core. |
|
|
Rask.Outbox
A transactional outbox for Rask.Data entities: domain events marked `IOutboxEvent` are written to an `OutboxMessage` table in the **same transaction** as the change that raised them (so an event is never lost and never fires for a rolled-back change), then a background `OutboxProcessor` polls the table and publishes them through Rask.Cqrs — at-least-once, crash-safe delivery, all on the app's own database (no broker, no Redis). A source generator registers each event type for reflection-free lookup. Server-side; pairs with Rask.Data. |
|
|
Rask.Jobs
Durable background jobs for a Rask app, stored in its own database — no broker, no Redis. Enqueue a job (an `IJobs`, dispatched to its Rask.Cqrs `ICommandHandler`) and a background `JobProcessor` polls the table and runs it — at-least-once, with exponential-backoff retries. Supports delayed (run-at) jobs and durable interval-recurring jobs. A source generator registers each job type for reflection-free lookup. Server-side; pairs with Rask.Cqrs and EF Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.23.1-alpha.0.84 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.81 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.80 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.79 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.78 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.76 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.74 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.72 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.70 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.69 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.68 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.67 | 0 | 9/25/2026 |
| 0.23.1-alpha.0.66 | 31 | 9/24/2026 |
| 0.23.1-alpha.0.65 | 34 | 9/24/2026 |
| 0.23.1-alpha.0.64 | 29 | 9/24/2026 |
| 0.23.1-alpha.0.62 | 33 | 9/24/2026 |
| 0.23.1-alpha.0.61 | 42 | 9/24/2026 |
| 0.23.1-alpha.0.50 | 41 | 9/24/2026 |
| 0.23.1-alpha.0.49 | 39 | 9/24/2026 |
| 0.23.0 | 224 | 9/18/2026 |