PouryaKit.Cqrs
0.1.0-preview.2
dotnet add package PouryaKit.Cqrs --version 0.1.0-preview.2
NuGet\Install-Package PouryaKit.Cqrs -Version 0.1.0-preview.2
<PackageReference Include="PouryaKit.Cqrs" Version="0.1.0-preview.2" />
<PackageVersion Include="PouryaKit.Cqrs" Version="0.1.0-preview.2" />
<PackageReference Include="PouryaKit.Cqrs" />
paket add PouryaKit.Cqrs --version 0.1.0-preview.2
#r "nuget: PouryaKit.Cqrs, 0.1.0-preview.2"
#:package PouryaKit.Cqrs@0.1.0-preview.2
#addin nuget:?package=PouryaKit.Cqrs&version=0.1.0-preview.2&prerelease
#tool nuget:?package=PouryaKit.Cqrs&version=0.1.0-preview.2&prerelease

PouryaKit.Cqrs
Commands and queries that run as Operations through one fixed pipeline. You declare each Feature as a sealed record with exactly one handler and send it. The Kit runs it through logging, the optional authorization hook, optional validation and the handler, and a command's handler runs inside the Unit of Work, which commits once for the whole Operation.
Install
dotnet add package PouryaKit.Cqrs --prerelease
When to use it
- You are writing a Feature: a command that changes an aggregate, or a query that answers a read.
- A client may send a command again after a response it never received, and should get the first answer.
- A query returns a list that an Actor sorts, filters and pages.
- One command or query needs a rule of its own about who may run it.
It pairs with PouryaKit.Validation for input checks, PouryaKit.Modularity for a Module's Gateway, PouryaKit.Persistence.Postgres for the Unit of Work and PouryaKit.Web for endpoints.
Quick start
Register the Features in the Module's Composition Root:
module.AddPouryaKitCqrs();
Declare the command and its one handler, as the Proving Sample does:
[Idempotent]
internal sealed record CreateProductCommand(Guid ProductId, Guid CategoryId, string Name)
: Command<Guid>;
internal sealed class CreateProductCommandHandler(
IRepository<Product, ProductId> products,
OperationContext context
) : CommandHandler<CreateProductCommand, Guid>
{
public override async Task<Result<Guid>> Handle(
CreateProductCommand command,
CancellationToken cancellationToken
)
{
var product = Product.Create(
new ProductId(command.ProductId),
new CategoryId(command.CategoryId),
command.Name,
context.Tenant!
);
if (product.IsFailure)
{
return product.Errors;
}
await products.AddAsync(product.Value, cancellationToken);
return product.Value.Id.Value;
}
}
What you get
- One fixed pipeline for every command and query, with nothing to add per Feature.
- A
Resultfrom every handler, so an expected business failure is an Error and never an exception. - An
OperationContextthat says who and what caused the Operation, wherever it runs. [Idempotent]on a command, so a repeat of a request answers with the first success.- A Page declared on a query, sorted and filtered only by what the query allows.
- A Host that refuses its own composition mistakes when it is built, with a composition check that names each one.
A handler returns a Result and never saves. The Unit of Work owns saving, committing, transactions and the Outbox (Persistence and the Unit of Work).
Learn more
| 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
- Microsoft.Extensions.DependencyInjection (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- PouryaKit.Core (>= 0.1.0-preview.2)
- PouryaKit.Domain (>= 0.1.0-preview.2)
NuGet packages (14)
Showing the top 5 NuGet packages that depend on PouryaKit.Cqrs:
| Package | Downloads |
|---|---|
|
PouryaKit.Persistence.EFCore
The EF Core Unit of Work: a DbContext per Module that saves and commits each Operation once, with the repository, audit, soft delete and conflicts as Errors. |
|
|
PouryaKit.Messaging.Wolverine
Durable deliveries on Wolverine with the message store in PostgreSQL: Notifications, Integration Events, Snapshots, delayed and recurring commands, each retried on its own. |
|
|
PouryaKit.Modularity
Modules for a Host: each Module's Composition Root declares what it needs and offers, and its Gateway runs every Operation from outside in a scope of its own. |
|
|
PouryaKit.Web
ASP.NET Core endpoints beside each Feature: authenticated access by default, one problem response for every failure and outgoing HTTP that carries the Operation Context. |
|
|
PouryaKit.Storage
One file storage contract for Feature code: upload, download, delete and presigned links, each returning a Result, with no cloud SDK in a Module. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 185 | 11/1/2026 |
| 0.1.0-preview.1 | 211 | 10/31/2026 |
| 0.1.0-preview.0.28 | 194 | 10/26/2026 |