NPv.CQS.Abstraction 1.0.0

Suggested Alternatives

NPv.CQS.Abstractions

Additional Details

Global renaming

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

NPv.CQS.Abstractions

Minimal, dependency-free contracts for applications following the Command-Query Separation (CQS) pattern.


✨ Overview

NPv.CQS.Abstractions is a foundational library containing interfaces and contracts for building systems based on the Command-Query Separation (CQS) principle.

It does not include any infrastructure or implementation β€” just the minimal building blocks: declarative command and query builders that allow infrastructure to resolve and invoke handlers automatically.

Use this package in your domain, application, or core layers to define behaviors without pulling in any dependencies.


πŸ”§ Interfaces Included

🟒 Commands

Interface Purpose
ICommand<TContext> Represents an action that changes system state (fire-and-forget)
ICommandBuilder Resolves and executes a command based on the given context. Allows declarative usage and central orchestration (e.g., in infrastructure or faΓ§ade services)
ICommandContext Encapsulates input data for building a command (e.g., DTO, form model, metadata)

πŸ”΅ Queries

Interface Purpose
IQuery<TCriterion, TResult> Represents a read-only operation that returns data for a specific criterion
ICriterion Input object used to filter, locate, or define query parameters in a composable and type-safe way
IQueryBuilder Resolves and executes a query using a registered builder based on the criterion type and expected result type. Useful for declarative, infrastructure-level orchestration
IQueryFor<TEntity> Marker interface for queries that return a specific entity type

πŸ“¦ Installation

dotnet add package NPv.CQS.Abstractions

πŸ’‘ Example

public record CreateOrderCommandContext(Guid OrderId, decimal Amount) : ICommandContext;

public class CreateOrderCommand : ICommand<CreateOrderCommandContext>
{
    public async Task ExecuteAsync(CreateOrderCommandContext context)
    {
        // Your domain logic here
        await DoWork();
    }
}
public record FindById(Guid Id) : ICriterion;

public class FindOrderByIdQuery(IOrderService _orderService) : IQuery<FindById, Order>
{
    public async Task<Order> AskAsync(ICriterion criterion) =>
        await _orderService.Get(criterion.Id);
}

πŸ“š Designed For Use With

  • NPv.CQS.Infrastructure – implementation (dispatcher, DI, Autofac module)
  • Any CQS/CQRS-based application structure

βš–οΈ License

MIT β€” you are free to use this in commercial and open-source software.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.
  • net9.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