Rask.Cqrs
0.20.0
See the version list below for details.
dotnet add package Rask.Cqrs --version 0.20.0
NuGet\Install-Package Rask.Cqrs -Version 0.20.0
<PackageReference Include="Rask.Cqrs" Version="0.20.0" />
<PackageVersion Include="Rask.Cqrs" Version="0.20.0" />
<PackageReference Include="Rask.Cqrs" />
paket add Rask.Cqrs --version 0.20.0
#r "nuget: Rask.Cqrs, 0.20.0"
#:package Rask.Cqrs@0.20.0
#addin nuget:?package=Rask.Cqrs&version=0.20.0
#tool nuget:?package=Rask.Cqrs&version=0.20.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.DispatchAsync(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. |
-
net10.0
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Rask.Cqrs:
| Package | Downloads |
|---|---|
|
Rask.Data
A tiny, provider-agnostic data layer for Entity Framework Core apps: an `Entity<TId>` base (Id, CreatedAt/UpdatedAt audit stamps, and a domain-events collection) plus opt-in marker interfaces (`ISoftDeletable`, `IVersioned`) driven by three `ISaveChangesInterceptor`s — auditing timestamps, transparent soft delete (rewrites a hard delete to a `DeletedAt` stamp behind a global query filter), and after-commit domain-event publication through Rask.Cqrs. `modelBuilder.ApplyRaskConventions()` wires the query filter + optimistic-concurrency token automatically. The base of the `rask generate feature` scaffolder's soft-delete/concurrency/events output. |
|
|
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 `IJob`, 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. |
|
|
Rask.Cqrs.Server
The server half of Rask.Cqrs remote dispatch. `MapRaskCqrs()` maps one GET and one POST endpoint that resolve a message by name against the generated allow-list, authorize it, and dispatch it to its ordinary handler — no controllers, no DTO plumbing, no per-message routes. Queries answer JSON or a streamed file; commands accept JSON or multipart uploads. |
|
|
Rask.Cqrs.Client
The client half of Rask.Cqrs remote dispatch. Register it and a message with no local handler is sent to the server through the same `IDispatcher` call — queries as GET, commands as POST, files as multipart — with no HttpClient at the call site. Reflection-free: the wire codecs are source-generated, so it publishes clean under the WASM/AOT trimmer. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.20.1-alpha.0.228 | 37 | 9/4/2026 |
| 0.20.1-alpha.0.227 | 39 | 9/4/2026 |
| 0.20.1-alpha.0.226 | 43 | 9/4/2026 |
| 0.20.1-alpha.0.225 | 42 | 9/4/2026 |
| 0.20.1-alpha.0.224 | 46 | 9/4/2026 |
| 0.20.1-alpha.0.223 | 45 | 9/4/2026 |
| 0.20.1-alpha.0.221 | 51 | 9/4/2026 |
| 0.20.1-alpha.0.220 | 41 | 9/4/2026 |
| 0.20.1-alpha.0.217 | 53 | 9/4/2026 |
| 0.20.1-alpha.0.216 | 45 | 9/4/2026 |
| 0.20.1-alpha.0.215 | 51 | 9/3/2026 |
| 0.20.1-alpha.0.213 | 56 | 9/3/2026 |
| 0.20.1-alpha.0.212 | 56 | 9/3/2026 |
| 0.20.1-alpha.0.211 | 62 | 9/3/2026 |
| 0.20.1-alpha.0.210 | 63 | 9/3/2026 |
| 0.20.1-alpha.0.209 | 61 | 9/2/2026 |
| 0.20.1-alpha.0.208 | 60 | 9/2/2026 |
| 0.20.1-alpha.0.207 | 62 | 9/2/2026 |
| 0.20.1-alpha.0.206 | 58 | 9/2/2026 |
| 0.20.0 | 395 | 8/6/2026 |