Rask.Cqrs 0.19.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.Cqrs --version 0.19.0
                    
NuGet\Install-Package Rask.Cqrs -Version 0.19.0
                    
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="Rask.Cqrs" Version="0.19.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.Cqrs" Version="0.19.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.Cqrs" />
                    
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 Rask.Cqrs --version 0.19.0
                    
#r "nuget: Rask.Cqrs, 0.19.0"
                    
#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 Rask.Cqrs@0.19.0
                    
#: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=Rask.Cqrs&version=0.19.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Cqrs&version=0.19.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.19.1-alpha.0.62 0 8/5/2026
0.19.1-alpha.0.57 0 8/5/2026
0.19.1-alpha.0.51 0 8/5/2026
0.19.1-alpha.0.43 17 8/5/2026
0.19.1-alpha.0.42 22 8/5/2026
0.19.1-alpha.0.40 24 8/5/2026
0.19.1-alpha.0.38 22 8/5/2026
0.19.1-alpha.0.32 25 8/5/2026
0.19.1-alpha.0.31 33 8/4/2026
0.19.1-alpha.0.30 32 8/4/2026
0.19.1-alpha.0.28 31 8/4/2026
0.19.1-alpha.0.25 38 8/4/2026
0.19.1-alpha.0.24 35 8/4/2026
0.19.1-alpha.0.23 35 8/4/2026
0.19.1-alpha.0.14 51 8/3/2026
0.19.1-alpha.0.13 44 8/3/2026
0.19.1-alpha.0.12 47 8/3/2026
0.19.1-alpha.0.11 45 8/3/2026
0.19.1-alpha.0.6 37 8/3/2026
0.19.0 134 7/20/2026
Loading failed