MiddleMan.Zero
1.1.2
dotnet add package MiddleMan.Zero --version 1.1.2
NuGet\Install-Package MiddleMan.Zero -Version 1.1.2
<PackageReference Include="MiddleMan.Zero" Version="1.1.2" />
<PackageVersion Include="MiddleMan.Zero" Version="1.1.2" />
<PackageReference Include="MiddleMan.Zero" />
paket add MiddleMan.Zero --version 1.1.2
#r "nuget: MiddleMan.Zero, 1.1.2"
#:package MiddleMan.Zero@1.1.2
#addin nuget:?package=MiddleMan.Zero&version=1.1.2
#tool nuget:?package=MiddleMan.Zero&version=1.1.2
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 responseHandlerBase<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 ofResultBaseResult<TResponse>: Concrete implementation ofResultBase<TResponse>
Message Types
DebugMessage: For diagnostic informationFailureMessage: For operation failuresInvalidRequestMessage: For validation errorsNotFoundMessage: 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
- Request validation via
ValidateAsync - Fast-fail if validation errors exist
- Request processing via
HandleAsync - Automatic result creation based on context state
Installation
dotnet add package MiddleMan.Zero
Dependencies
- MiddleMan.Zero.Abstractions
Related Packages
- MiddleMan.Zero.DependencyInjection: Automatic handler registration
- MiddleMan.Zero.AspNetCore.Mvc: ASP.NET Core MVC integration
| Product | Versions 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. |
-
net10.0
- MiddleMan.Zero.Abstractions (>= 1.1.2)
-
net8.0
- MiddleMan.Zero.Abstractions (>= 1.1.2)
-
net9.0
- MiddleMan.Zero.Abstractions (>= 1.1.2)
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 |