CascadeEsdm.Commands 1.0.0-beta.12

This is a prerelease version of CascadeEsdm.Commands.
This package has a SemVer 2.0.0 package version: 1.0.0-beta.12+883e346.
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 CascadeEsdm.Commands --version 1.0.0-beta.12
                    
NuGet\Install-Package CascadeEsdm.Commands -Version 1.0.0-beta.12
                    
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="CascadeEsdm.Commands" Version="1.0.0-beta.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CascadeEsdm.Commands" Version="1.0.0-beta.12" />
                    
Directory.Packages.props
<PackageReference Include="CascadeEsdm.Commands" />
                    
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 CascadeEsdm.Commands --version 1.0.0-beta.12
                    
#r "nuget: CascadeEsdm.Commands, 1.0.0-beta.12"
                    
#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 CascadeEsdm.Commands@1.0.0-beta.12
                    
#: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=CascadeEsdm.Commands&version=1.0.0-beta.12&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CascadeEsdm.Commands&version=1.0.0-beta.12&prerelease
                    
Install as a Cake Tool

Cascade.Commands

Command handling implementation for the Cascade Event Sourcing framework.

Overview

This package provides the concrete implementation of command handling infrastructure for event-sourced systems. It includes command bus, handler registration, validation pipeline, and integration with dependency injection.

Features

  • Command Bus: In-memory command dispatcher with middleware support
  • Handler Registration: Automatic discovery and registration of command handlers
  • Validation Pipeline: Built-in command validation before execution
  • Dependency Injection: First-class support for Microsoft.Extensions.DependencyInjection
  • Error Handling: Comprehensive error handling and result types
  • Middleware Support: Extensible pipeline for cross-cutting concerns

Installation

dotnet add package Cascade.Commands

This will automatically include dependencies:

  • Cascade.Commands.Abstractions
  • Cascade.SharedKernel

Usage

Register Command Handlers

using Cascade.Commands;

services.AddCascadeCommands(options =>
{
    options.RegisterHandlersFromAssembly(typeof(PlaceOrderHandler).Assembly);
});

Implement a Command Handler

public class PlaceOrderHandler : ICommandHandler<PlaceOrderCommand>
{
    private readonly IOrderRepository _repository;
    
    public PlaceOrderHandler(IOrderRepository repository)
    {
        _repository = repository;
    }
    
    public async Task<CommandResult> HandleAsync(
        PlaceOrderCommand command, 
        CancellationToken cancellationToken)
    {
        var order = new Order();
        order.PlaceOrder(command.OrderId, command.CustomerId);
        
        await _repository.SaveAsync(order, cancellationToken);
        
        return CommandResult.Success();
    }
}

Execute Commands

public class OrderController : ControllerBase
{
    private readonly ICommandBus _commandBus;
    
    public OrderController(ICommandBus commandBus)
    {
        _commandBus = commandBus;
    }
    
    [HttpPost]
    public async Task<IActionResult> PlaceOrder(PlaceOrderRequest request)
    {
        var command = new PlaceOrderCommand(request.OrderId, request.CustomerId);
        var result = await _commandBus.SendAsync(command);
        
        return result.IsSuccess ? Ok() : BadRequest(result.Errors);
    }
}

Add Command Validation

public class PlaceOrderValidator : ICommandValidator<PlaceOrderCommand>
{
    public Task<ValidationResult> ValidateAsync(PlaceOrderCommand command)
    {
        if (command.OrderId == null)
            return ValidationResult.Failure("OrderId is required");
            
        if (command.CustomerId == null)
            return ValidationResult.Failure("CustomerId is required");
            
        return ValidationResult.Success();
    }
}

Dependencies

  • Cascade.Commands.Abstractions
  • Cascade.SharedKernel
  • Microsoft.Extensions.DependencyInjection.Abstractions
  • Cascade.Views: Query/view implementation for CQRS
  • Cascade.Storage.CosmosDb: Event store implementation

Documentation

For complete documentation, examples, and best practices, visit: https://github.com/tsgenge/cascade

License

BSD 3-Clause License - see LICENSE file for details

Product Compatible and additional computed target framework versions.
.NET 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

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