NPv.CQS.Infrastructure 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package NPv.CQS.Infrastructure --version 1.0.1
                    
NuGet\Install-Package NPv.CQS.Infrastructure -Version 1.0.1
                    
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.Infrastructure" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NPv.CQS.Infrastructure" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="NPv.CQS.Infrastructure" />
                    
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.Infrastructure --version 1.0.1
                    
#r "nuget: NPv.CQS.Infrastructure, 1.0.1"
                    
#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.Infrastructure@1.0.1
                    
#: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.Infrastructure&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=NPv.CQS.Infrastructure&version=1.0.1
                    
Install as a Cake Tool

NPv.CQS.Infrastructure

Infrastructure for declarative execution of commands and queries in CQS-based applications.
Includes dispatcher, default implementations, and Autofac integration.


โœจ Overview

NPv.CQS.Infrastructure provides essential building blocks for executing commands and queries defined using NPv.CQS.Abstractions.

It includes:

  • A dispatcher for resolving and executing handlers,
  • Default implementations of ICommandBuilder and IQueryBuilder,
  • Autofac module for automatic handler registration by namespace.

This package is intended for the application or composition root layers, where behaviors are wired and executed.


๐Ÿ”ง Key Features

  • ๐Ÿ“ฆ Built-in ICommandBuilder and IQueryBuilder implementations
  • ๐Ÿ“ก Centralized IDispatcher for command and query execution
  • ๐Ÿงฉ CQSModule for seamless Autofac integration via namespace scanning
  • โš™๏ธ Type-safe, convention-based resolution and orchestration of handlers
  • ๐Ÿ’ก Compatible with all abstractions from NPv.CQS.Abstractions

๐Ÿ“ฆ Installation

dotnet add package NPv.CQS.Infrastructure

๐Ÿงช Usage Example

1. Register Autofac Module (in Program.cs)

builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());

builder.Host.ConfigureContainer<ContainerBuilder>(container =>
{
    container.RegisterModule(new CQSModule("YourApp.HandlersNamespace"));
});

2. Execute a Command Declaratively

await _commandBuilder.ExecuteAsync(new CreateOrderCommandContext(orderId, amount));

3. Execute a Query Declaratively

var order = await _queryBuilder.For<Order>().With(new FindById(orderId));

No need to resolve handlers manually โ€” the infrastructure handles it based on context and criterion types.


๐Ÿงฉ Components Included

Component Purpose
CQSModule Autofac module for scanning and registering command/query handlers
Dispatcher Central abstraction for invoking commands and queries via builders
CommandBuilder Resolves and executes ICommand<TContext> for a given context
QueryBuilder Resolves and executes IQuery<TCriterion, TResult> for a given criterion
Default implementations Internal infrastructure for resolving types and linking abstractions
  • NPv.CQS.Abstractions โ€“ core interfaces and contracts
  • NPv.Events.Abstractions (planned) โ€“ contracts for event-driven extensions
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.

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.1.0 147 8/10/2025
1.0.2 122 5/23/2025
1.0.1 151 5/19/2025
1.0.0 145 5/19/2025