MiddleMan.Zero.DependencyInjection 1.1.2

dotnet add package MiddleMan.Zero.DependencyInjection --version 1.1.2
                    
NuGet\Install-Package MiddleMan.Zero.DependencyInjection -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.DependencyInjection" 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.DependencyInjection" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="MiddleMan.Zero.DependencyInjection" />
                    
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.DependencyInjection --version 1.1.2
                    
#r "nuget: MiddleMan.Zero.DependencyInjection, 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.DependencyInjection@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.DependencyInjection&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=MiddleMan.Zero.DependencyInjection&version=1.1.2
                    
Install as a Cake Tool

MiddleMan.Zero.DependencyInjection

Dependency injection extensions for automatic registration of MiddleMan.Zero handlers.

Overview

This package provides extension methods for IServiceCollection to automatically discover and register all MiddleMan.Zero handlers in your application.

Features

  • Automatic Handler Discovery: Scans all loaded assemblies for handler implementations
  • Flexible Lifetime Management: Configure handler lifetimes (Transient, Scoped, Singleton)
  • Convention-Based Registration: Automatically registers handlers by their implemented interfaces

Usage

Basic Registration

using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();

// Register all handlers with transient lifetime (default)
services.AddMiddleManZero();

Custom Lifetime

// Register handlers with scoped lifetime
services.AddMiddleManZero(ServiceLifetime.Scoped);

// Register handlers with singleton lifetime
services.AddMiddleManZero(ServiceLifetime.Singleton);

ASP.NET Core Integration

var builder = WebApplication.CreateBuilder(args);

// Add MiddleMan.Zero handlers
builder.Services.AddMiddleManZero();

var app = builder.Build();

Using Handlers

public class OrdersController : ControllerBase
{
    private readonly IHandleAsync<GetOrderRequest, Order> _handler;

    public OrdersController(IHandleAsync<GetOrderRequest, Order> handler)
    {
        _handler = handler;
    }

    [HttpGet("{id}")]
    public async Task<IActionResult> GetOrder(int id)
    {
        var request = new GetOrderRequest { OrderId = id };
        var result = await _handler.HandleAsync(request);
        return result.ToActionResult();
    }
}

Installation

dotnet add package MiddleMan.Zero.DependencyInjection

Dependencies

  • MiddleMan.Zero.Abstractions
  • Microsoft.Extensions.DependencyInjection.Abstractions

How It Works

The AddMiddleManZero extension method:

  1. Scans all assemblies in the current AppDomain
  2. Identifies types implementing IHandleAsync<> or IHandleAsync<,>
  3. Registers each handler with its interface in the service collection
  4. Uses the specified service lifetime (default: Transient)
  • MiddleMan.Zero: Core implementation
  • MiddleMan.Zero.Abstractions: Core interfaces
  • 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

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
1.1.2 239 2/28/2026
1.1.2-rc.1 49 2/28/2026
1.1.1 148 2/18/2026
1.1.0 100 2/15/2026
1.0.0 101 2/5/2026