NPv.CQS.Infrastructure
1.0.1
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
<PackageReference Include="NPv.CQS.Infrastructure" Version="1.0.1" />
<PackageVersion Include="NPv.CQS.Infrastructure" Version="1.0.1" />
<PackageReference Include="NPv.CQS.Infrastructure" />
paket add NPv.CQS.Infrastructure --version 1.0.1
#r "nuget: NPv.CQS.Infrastructure, 1.0.1"
#:package NPv.CQS.Infrastructure@1.0.1
#addin nuget:?package=NPv.CQS.Infrastructure&version=1.0.1
#tool nuget:?package=NPv.CQS.Infrastructure&version=1.0.1
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
andIQueryBuilder
, - 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
andIQueryBuilder
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 |
๐ Related Packages
NPv.CQS.Abstractions
โ core interfaces and contractsNPv.Events.Abstractions
(planned) โ contracts for event-driven extensions
Product | Versions 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. |
-
net9.0
- Autofac.Extras.AggregateService (>= 6.1.2)
- NPv.CQS.Abstractions (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.