CQRSharp.Generators 3.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package CQRSharp.Generators --version 3.0.0
                    
NuGet\Install-Package CQRSharp.Generators -Version 3.0.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="CQRSharp.Generators" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CQRSharp.Generators" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CQRSharp.Generators" />
                    
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 CQRSharp.Generators --version 3.0.0
                    
#r "nuget: CQRSharp.Generators, 3.0.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 CQRSharp.Generators@3.0.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=CQRSharp.Generators&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CQRSharp.Generators&version=3.0.0
                    
Install as a Cake Tool

CQRSharp

NuGet version (CQRSharp) CodeQL

Alt

A lightweight, extensible, and attribute-driven Command Query Responsibility Segregation (CQRS) framework for .NET applications, with complete Native AOT support.

A Roslyn source generator wires up dispatching and registration at compile time, so there is no runtime reflection and the whole framework is trimming- and Native-AOT-friendly.

For more information, see the CQRSharp project page.


Features

  • Native AOT & trimming-safe — a Roslyn source generator wires up all dispatch and registration at compile time; zero runtime reflection.
  • Attribute-driven — define commands, queries, streaming requests, and notifications with simple marker interfaces and handlers.
  • One façade — dispatch everything through ICqrsDispatcher (Send / Stream / Publish).
  • Build-time analyzers — catch missing handlers, the wrong dispatch method, and mis-wired pipeline exemptions as you type (CQRA diagnostics), with code fixes.
  • Opt-in pipeline behaviors — validation, resilience/retries, timeouts, rate limiting, idempotency, unit-of-work, and logging via AddCqrsPipelinePack.
  • Reliable messaging — a background task queue and a transactional outbox with at-least-once delivery and distributed-tracing propagation.
  • Introspection — a diagnostics API and health checks that describe exactly how each request is bound.

Installation

dotnet add package CQRSharp

The CQRSharp meta-package pulls in the abstractions, core runtime, and the source generator for a plug-and-play setup.

Quick Start

Register CQRSharp on your host. AddCqrsGenerated is emitted by the source generator and wires up every discovered handler:

using CQRSharp.Core.Extensions;

services.AddCqrsGenerated();

Define a command and its handler:

using CQRSharp.Abstractions.Interfaces.Handlers;
using CQRSharp.Abstractions.Interfaces.Markers.Command;
using CQRSharp.Abstractions.Models.Commands;

public sealed class CreateUser : CommandBase
{
    public required string Name { get; init; }
}

public sealed class CreateUserHandler : ICommandHandler<CreateUser>
{
    public Task<CommandResult> Handle(CreateUser command, CancellationToken ct)
        => Task.FromResult(CommandResult.FromSuccess());
}

Dispatch it through the single injected façade, ICqrsDispatcher:

public sealed class UsersController(ICqrsDispatcher dispatcher)
{
    public Task Create(string name)
        => dispatcher.Send(new CreateUser { Name = name });
}

Queries derive from QueryBase<TResult> and are handled by IQueryHandler<TQuery, TResult>; streaming requests are dispatched with dispatcher.Stream, and notifications implement INotification and are published with dispatcher.Publish. Use CommandBase<TContext> / QueryBase<TResult, TContext> when a request needs a custom context. Cross-cutting behaviors (validation, rate limiting, timeout, resilience, unit-of-work, idempotency) are opt-in via AddCqrsPipelinePack.


Contributing

Contributions are welcome! Please open issues and pull requests for bug fixes, enhancements, or new features.

To contribute:

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Submit a pull request.

Please ensure that your code follows the project's coding standards and includes appropriate tests.


License

This project is licensed under the MIT License.


Note: This project is in active development.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated