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
<PackageReference Include="CQRSDecorate.Net" Version="1.0.0" />
<PackageVersion Include="CQRSDecorate.Net" Version="1.0.0" />
<PackageReference Include="CQRSDecorate.Net" />
paket add CQRSDecorate.Net --version 1.0.0
#r "nuget: CQRSDecorate.Net, 1.0.0"
#:package CQRSDecorate.Net@1.0.0
#addin nuget:?package=CQRSDecorate.Net&version=1.0.0
#tool nuget:?package=CQRSDecorate.Net&version=1.0.0
🧩 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 | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 9.0.9)
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 |