CommandQuery is a CQRS implementation.
Supports request/response, commands, queries, notifications and events, synchronous and async with intelligent dispatching via C# generic variance.
Examples in this Project.
You should install CommandQuery with NuGet
Install-Package Bas24.CommandQueryOr via the .NET Core command line interface:
dotnet add package Bas24.CommandQueryservices.CommandQuery(cq => cq.RegisterAssembly(typeof(Program).Assembly));This registers:
ICommandQueryas scopedIRequestHandler<,>concrete implementations as transientIRequestHandler<>concrete implementations as transientINotificationHandler<>concrete implementations as transient
This also registers open generic implementations for:
INotificationHandler<>
To register behaviors, pre/post processors:
services.AddCommandQuery(cfg => {
cq.RegisterAssembly(typeof(Program).Assembly);
cq.NotificationPublisher = new MultipleNotificationPublisher();
cq.NotificationPublisherType = typeof(MultipleNotificationPublisher);
cq.AddBehavior(typeof(LoggingPipelineBehavior<,>));
cq.AddRequestPreProcessor(typeof(GenericRequestPreProcessor<>));
cq.AddRequestPostProcessor(typeof(GenericRequestPostProcessor<,>));
});With additional methods for open generics and overloads for explicit service types.