PouryaKit.Cqrs 0.1.0-preview.2

This is a prerelease version of PouryaKit.Cqrs.
dotnet add package PouryaKit.Cqrs --version 0.1.0-preview.2
                    
NuGet\Install-Package PouryaKit.Cqrs -Version 0.1.0-preview.2
                    
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="PouryaKit.Cqrs" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PouryaKit.Cqrs" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="PouryaKit.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 PouryaKit.Cqrs --version 0.1.0-preview.2
                    
#r "nuget: PouryaKit.Cqrs, 0.1.0-preview.2"
                    
#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 PouryaKit.Cqrs@0.1.0-preview.2
                    
#: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=PouryaKit.Cqrs&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PouryaKit.Cqrs&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

PouryaKit.Cqrs

NuGet .NET 10 License: MIT

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 Result from every handler, so an expected business failure is an Error and never an exception.
  • An OperationContext that 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 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 (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