MiddleMan.Zero 1.1.2

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

MiddleMan.Zero

Core implementation of the MiddleMan.Zero mediator pattern library for .NET.

Overview

MiddleMan.Zero provides a lightweight, zero-ceremony implementation of the mediator pattern. It handles request/response workflows with built-in validation, error handling, and message logging.

Key Components

Base Classes

  • HandlerBase<TRequest>: Abstract base class for handlers without a response
  • HandlerBase<TRequest, TResponse>: Abstract base class for handlers with a typed response

Context

  • HandlerContext: Manages handler execution state and message logging
    • Tracks request validation status
    • Logs debug, failure, invalid request, and not found messages
    • Provides access to all logged messages

Result Types

  • Result: Concrete implementation of ResultBase
  • Result<TResponse>: Concrete implementation of ResultBase<TResponse>

Message Types

  • DebugMessage: For diagnostic information
  • FailureMessage: For operation failures
  • InvalidRequestMessage: For validation errors
  • NotFoundMessage: For resource not found scenarios

Usage

Creating a Handler

public class GetOrderHandler : HandlerBase<GetOrderRequest, Order>
{
    protected override async Task ValidateAsync(
        GetOrderRequest request, 
        HandlerContext context, 
        CancellationToken cancellationToken)
    {
        if (request.OrderId <= 0)
        {
            context.AddInvalidRequestMessage("Invalid order ID");
        }
    }

    protected override async Task<Order?> HandleAsync(
        GetOrderRequest request, 
        HandlerContext context, 
        CancellationToken cancellationToken)
    {
        var order = await _repository.GetOrderAsync(request.OrderId);
        
        if (order == null)
        {
            context.NotFound("Order not found");
            return null;
        }
        
        return order;
    }
}

Handler Execution Flow

  1. Request validation via ValidateAsync
  2. Fast-fail if validation errors exist
  3. Request processing via HandleAsync
  4. Automatic result creation based on context state

Installation

dotnet add package MiddleMan.Zero

Dependencies

  • MiddleMan.Zero.Abstractions
  • MiddleMan.Zero.DependencyInjection: Automatic handler registration
  • MiddleMan.Zero.AspNetCore.Mvc: ASP.NET Core MVC integration
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 (2)

Showing the top 2 NuGet packages that depend on MiddleMan.Zero:

Package Downloads
MiddleMan.Zero.AspNetCore.Http

ASP.NET Core Http integration for MiddleMan.Zero providing automatic conversion of Result objects to IResult with appropriate HTTP status codes.

MiddleMan.Zero.AspNetCore.Mvc

ASP.NET Core MVC integration for MiddleMan.Zero providing automatic conversion of Result objects to IActionResult with appropriate HTTP status codes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 270 2/28/2026
1.1.2-rc.1 54 2/28/2026
1.1.1 183 2/18/2026
1.1.0 94 2/15/2026
1.0.0 113 2/5/2026