CQRSDecorate.Net 1.0.0

Prefix Reserved
dotnet add package CQRSDecorate.Net --version 1.0.0
                    
NuGet\Install-Package CQRSDecorate.Net -Version 1.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="CQRSDecorate.Net" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CQRSDecorate.Net" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CQRSDecorate.Net" />
                    
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 CQRSDecorate.Net --version 1.0.0
                    
#r "nuget: CQRSDecorate.Net, 1.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 CQRSDecorate.Net@1.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=CQRSDecorate.Net&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CQRSDecorate.Net&version=1.0.0
                    
Install as a Cake Tool

🧩 CQRSDecorate.Net

CQRSDecorate.Net is a lightweight and extensible library for implementing the CQRS (Command Query Responsibility Segregation) pattern with full Decorator Pattern support in .NET.

It provides a clean, maintainable, and testable approach to separating Command and Query logic while allowing the injection of cross-cutting concerns such as Logging, Validation, Caching, and Authorization through decorators — keeping your handlers clean and focused.


🚀 Key Features

  • ✅ Full CQRS pattern implementation
  • ⚙️ Built-in Decorator Pattern support
  • 🧱 Simple integration with Dependency Injection
  • 📦 Works with .NET 6+ and C# 10+
  • 🧩 Clean, testable architecture
  • 🔄 Supports Commands, Queries, and Pipeline Behaviors

🧠 Concept

Instead of mixing read and write logic in the same service, CQRSDecorate.Net separates responsibilities clearly:

  • Commands → change state (e.g., create, update, delete)
  • Queries → retrieve data (without modifying state)

Each Command or Query can be processed through one or more decorators before reaching the main handler, giving full control over execution pipelines.


🧰Why Use This Library?

  • Reduces boilerplate code
  • Promotes Single Responsibility Principle
  • Enables easy unit testing of each handler
  • Supports pipeline decorators similar to MediatR — but with a cleaner, lighter implementation

I’ve also built a real-world project implementation using this package a full setup of CQRS + Decorator Pattern working together seamlessly.

🔗 Full Implementation : https://github.com/erhankrasniqi/CQRS-Decorator-Full-Implementation

🧩 Basic Structure

public record CreateUserCommand(string Name, string Email) : ICommand<Guid>;

public class CreateUserHandler : ICommandHandler<CreateUserCommand, Guid>
{
    public async Task<Guid> Handle(CreateUserCommand command, CancellationToken cancellationToken)
    {
        // User creation logic
        var userId = Guid.NewGuid();
        Console.WriteLine($"User created: {command.Name}");
        return await Task.FromResult(userId);
    }
}
 

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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

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
1.0.0 219 10/4/2025