MSDevTech.MediatX 1.0.0

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

MediatX

Enterprise-grade mediator pattern implementation with pipelines, async support, and DI integration. An alternative to MediatR.

Features

  • Implements the mediator pattern for decoupled request/response and notification handling
  • Supports pipeline behaviors for cross-cutting concerns (logging, validation, etc.)
  • Asynchronous request and notification handling
  • Seamless integration with Microsoft.Extensions.DependencyInjection
  • Targets .NET 8 and .NET 9

Installation

Add the NuGet package to your project:

dotnet add package MediatX

Usage

  1. Register MediatX in your DI container:
using MediatX;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMediatX(typeof(Startup).Assembly);
  1. Define a Request and Handler:
public class Ping : IRequest<string> { }

public class PingHandler : IRequestHandler<Ping, string>
{
    public Task<string> Handle(Ping request, CancellationToken cancellationToken)
        => Task.FromResult("Pong");
}
  1. Send a Request:
public class MyService
{
    private readonly IMediator _mediator;
    public MyService(IMediator mediator) => _mediator = mediator;

    public async Task<string> PingAsync()
    {
        return await _mediator.Send(new Ping());
    }
}
  1. Add Pipeline Behaviors (optional):
public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : IRequest<TResponse>
{
    public async Task<TResponse> Handle(
        TRequest request,
        RequestHandlerDelegate<TResponse> next,
        CancellationToken cancellationToken)
    {
        // Pre-processing
        Console.WriteLine($"Handling {typeof(TRequest).Name}");
        var response = await next();
        // Post-processing
        Console.WriteLine($"Handled {typeof(TRequest).Name}");
        return response;
    }
}

Contributing

Contributions are welcome! Please open issues or submit pull requests.

License

MIT

Repository

https://github.com/MSDevTech/MediatX

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 was computed.  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.0.0 219 7/17/2025