TaskHub.Shared

Command Pipeline

The Command Pipeline is a robust implementation of the Mediator pattern, providing a centralized way to handle business logic while supporting complex cross-cutting concerns through a flexible middleware system.

📖 Table of Contents

🚀 Key Features


Basic Usage Overview

// 1. Define Command
public record CreateTask(string Title) : ICommand;

// 2. Define Handler
public class Handler : ICommandHandler<CreateTask, Result>
{
    public async Task<Result> HandleAsync(CreateTask cmd, CancellationToken ct) 
        => ResultFactory.Success();
}

// 3. Send via Bus
var result = await bus.SendAsync<CreateTask, Result>(new CreateTask("Fix bug"));