RCommon.ApplicationServices 2.3.2-alpha.0.2

This is a prerelease version of RCommon.ApplicationServices.
dotnet add package RCommon.ApplicationServices --version 2.3.2-alpha.0.2
                    
NuGet\Install-Package RCommon.ApplicationServices -Version 2.3.2-alpha.0.2
                    
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="RCommon.ApplicationServices" Version="2.3.2-alpha.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RCommon.ApplicationServices" Version="2.3.2-alpha.0.2" />
                    
Directory.Packages.props
<PackageReference Include="RCommon.ApplicationServices" />
                    
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 RCommon.ApplicationServices --version 2.3.2-alpha.0.2
                    
#r "nuget: RCommon.ApplicationServices, 2.3.2-alpha.0.2"
                    
#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 RCommon.ApplicationServices@2.3.2-alpha.0.2
                    
#: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=RCommon.ApplicationServices&version=2.3.2-alpha.0.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RCommon.ApplicationServices&version=2.3.2-alpha.0.2&prerelease
                    
Install as a Cake Tool

RCommon.ApplicationServices

Provides a CQRS (Command Query Responsibility Segregation) implementation with dedicated command and query buses, handler registration, and optional validation integration for the RCommon framework.

Features

  • Command Bus -- dispatches commands to a single registered ICommandHandler<TResult, TCommand> and returns an IExecutionResult
  • Query Bus -- dispatches queries to a single registered IQueryHandler<TQuery, TResult> and returns a typed result
  • Validation pipeline -- optionally validates commands and/or queries before handler execution via IValidationService
  • Handler registration -- register handlers individually or scan assemblies with automatic decorator exclusion
  • Expression caching -- dynamically compiled handler delegates can be cached for improved dispatch performance
  • Fluent builder API -- integrates with the AddRCommon() builder pattern for clean DI configuration

Installation

dotnet add package RCommon.ApplicationServices

Usage

using RCommon;
using RCommon.ApplicationServices;

// Configure CQRS in your DI setup
services.AddRCommon(config =>
{
    config.WithCQRS<CqrsBuilder>(cqrs =>
    {
        // Register handlers individually
        cqrs.AddCommandHandler<CreateOrderHandler, CreateOrderCommand, CommandResult>();
        cqrs.AddQueryHandler<GetOrderHandler, GetOrderQuery, OrderDto>();

        // Or scan an assembly for all handlers
        cqrs.AddCommandHandlers(typeof(CreateOrderHandler).Assembly);
        cqrs.AddQueryHandlers(typeof(GetOrderHandler).Assembly);
    });
});

// Dispatch a command from your application layer
public class OrderService
{
    private readonly ICommandBus _commandBus;
    private readonly IQueryBus _queryBus;

    public OrderService(ICommandBus commandBus, IQueryBus queryBus)
    {
        _commandBus = commandBus;
        _queryBus = queryBus;
    }

    public async Task<CommandResult> CreateOrderAsync(CreateOrderCommand command)
    {
        return await _commandBus.DispatchCommandAsync(command);
    }

    public async Task<OrderDto> GetOrderAsync(GetOrderQuery query)
    {
        return await _queryBus.DispatchQueryAsync(query);
    }
}

Enabling Validation

services.AddRCommon(config =>
{
    config.WithValidation<FluentValidationBuilder>(validation =>
    {
        validation.UseWithCqrs(options =>
        {
            options.ValidateCommands = true;
            options.ValidateQueries = true;
        });
    });
});

Key Types

Type Description
ICommandBus Dispatches commands to their registered handler and returns an IExecutionResult
IQueryBus Dispatches queries to their registered handler and returns a typed result
ICommandHandler<TResult, TCommand> Handles a specific command type and produces an execution result
IQueryHandler<TQuery, TResult> Handles a specific query type and produces a result
IValidationService Validates objects before dispatch; integrates with the CQRS pipeline
ValidationOutcome Contains a list of ValidationFault errors produced by validation
ValidationFault Describes a single validation failure with property name, message, and severity
CqrsValidationOptions Controls whether commands and/or queries are validated before dispatch
CqrsBuilder Default ICqrsBuilder implementation that registers CommandBus and QueryBus

Documentation

For full documentation, visit rcommon.com.

License

Licensed under the Apache License, Version 2.0.

Product 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 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 is compatible.  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 (4)

Showing the top 4 NuGet packages that depend on RCommon.ApplicationServices:

Package Downloads
RCommon.ApplicationServices.Messaging

A cohesive set of .NET 7 infrastructure libraries that utilizes abstractions for persistence, unit of work/transactions, distributed events, distributed transactions, and more.

RCommon.MediatR

A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more

RCommon.FluentValidation

A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more

RCommon.ApplicationServices.MediatR

A lightweight application framework that utilizes abstractions over commonly used patterns to future proof applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.2-alpha.0.2 0 2/18/2026
2.3.2-alpha.0.1 38 2/9/2026
2.3.1 117 2/5/2026
2.3.0 116 2/3/2026
2.2.2-alpha.0.1 371 12/11/2025
2.2.1-alpha.0.2 133 10/24/2025
2.2.1-alpha.0.1 122 10/24/2025
2.1.11-alpha.0.2 121 10/24/2025
2.1.11-alpha.0.1 94 7/18/2025
2.1.10 342 7/17/2025
2.1.9-alpha.0.1 138 7/17/2025
2.1.2.4 297 5/21/2025
2.1.2.3 265 5/1/2025
2.1.2.2 601 1/23/2025
2.1.2.1 243 1/17/2025
2.1.2 236 1/17/2025
2.1.1.4 268 1/7/2025
2.1.1.3 269 11/22/2024
2.1.1.2 250 11/22/2024
0.0.0-alpha.0 142 7/17/2025
Loading failed