NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
NuGet, #133 most downloaded on NuGet
Simple, unambitious mediator implementation in .NET
Latest stable
15.0.0
Last release 11 days ago
12 Nov 2026
Ships fairly regularly
a new release about every 3 months
Most releases are documented
notes for 31 of 42 stable releases
4 versions withdrawn
withdrawn after publishing
127 years old
57 releases · first in 1900
Drag across the ruler to compare, or tap a release to open it.
Migrate docs from the wiki to Read the Docs by @jbogard in #1195
Fix BuildDateUtc embedding on Windows builds by @jbogard in #1182
Full Changelog: v14.2.0...v14.3.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Fix license validation deadlock when called from sync context by @jbogard in #1165
Full Changelog: v14.1.0...v14.2.0
Migrating to slnx by @jbogard in #1147
Full Changelog: v14.0.0...v14.1.0
Bumping to .NET 10 by @jbogard in #1143
Full Changelog: v13.1.0...v14.0.0
Nothing published for this version
Upgrade to System.Text.Json version without transitive vulnerability by @kanilsz in #1139
LightInject, StashBox, Lamar by @jithu7432 in #1137Full Changelog: v13.0.0...v13.1.0
Added support for .NET Standard 2.0
Full Changelog: v12.5.0...v13.0.0
To set your license key:
services.AddMediatR(cfg => {
cfg.LicenseKey = "<License key here>";
});You can obtain your license key at MediatR.io
GitHub Actions upload-artifacts@v2 deprecated moving to v4 by @jithu7432 in #1072
Nullable property from MediatR.Contracts by @jithu7432 in #1061Full Changelog: v12.4.1...v12.5.0
Make Auto Registration of Generic Handlers OPT-IN by @zachpainter77 in #1057
Full Changelog: v12.4.0...v12.4.1
Add Support For Generic Handlers With Multiple Generic Type Parameters by @zachpainter77 in https://github.com/jbogard/MediatR/pull/1048
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.3.0...v12.4.0
Fix AutoRegisterRequestProcessors to include all implementations by @hisuwh in https://github.com/jbogard/MediatR/pull/989
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.2.0...v12.3.0
Adding tests and upgrading to .NET 8 preview by @jbogard in https://github.com/jbogard/MediatR/pull/955
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.1.1...v12.2.0
Fixing registration problem; moving exception behaviors first so that… by @jbogard in https://github.com/jbogard/MediatR/pull/925
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.1.0...v12.1.1
https://github.com/jbogard/MediatR/wiki/Migration-Guide-12.0-to-12.1
https://github.com/jbogard/MediatR/wiki/Migration-Guide-12.0-to-12.1
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.0.1...v12.1.0
This release removes all scanning around behaviors, stream behaviors, and pre/post processors. That proved too problematic so you MUST register each of these explicitly with the appropriate registration methods inside AddMediatR. This also ensures that the order of behaviors and pre/post processors reflects the explicit order of registration. With the scanning approach, you couldn't control the order.
Use actual request type in new 'Send' method by @remcoros in https://github.com/jbogard/MediatR/pull/844
Full Changelog: https://github.com/jbogard/MediatR/compare/v12.0.0...v12.0.1
Added static modifier for lambdas where applicable in Mediatr project. by @sunero4 in https://github.com/jbogard/MediatR/pull/801
Migration Guide Full Changelog: https://github.com/jbogard/MediatR/compare/v11.1.0...v12.0.0
chore: fix typos by @lucianodelucchi in https://github.com/jbogard/MediatR/pull/777
Full Changelog: https://github.com/jbogard/MediatR/compare/v11.0.0...v11.1.0
Small grammatical change by @NRKirby in https://github.com/jbogard/MediatR/pull/740
Full Changelog: https://github.com/jbogard/MediatR/compare/v10.0.1...v11.0.0 Migration Guide: https://github.com/jbogard/MediatR/wiki/Migration-Guide-10.x-to-11.0
This is a patch release to support the latest Contracts package, which changed its targets to netstandard2.0 and net461.
This is a patch release to support the latest Contracts package, which changed its targets to netstandard2.0 and net461.
Although MediatR supports only netstandard2.1 and above, it should not force the consumers of the contracts as such.
This release adds support for IAsyncEnumerable . A new request type, IStreamRequest represents a request to create a stream, with a new handler type I
This release adds support for IAsyncEnumerable<T>. A new request type, IStreamRequest<T> represents a request to create a stream, with a new handler type IStreamRequestHandler<TRequest, TResponse> to handle. An example:
public class StreamPing : IStreamRequest<Pong>
{
public string? Message { get; init; }
}
public class PingStreamHandler : IStreamRequestHandler<StreamPing, Pong>
{
public async IAsyncEnumerable<Pong> Handle(StreamPing request,
[EnumeratorCancellation] CancellationToken cancellationToken)
{
yield return await Task.Run(() => new Pong { Message = request.Message + " Pang" }, cancellationToken);
}
}
Where the work inside of the handler would likely be calling some other streaming API, such as gRPC, EF Core streaming support, Dapper streaming etc.
There are also separate behaviors, with IStreamPipelineBehavior that are separate from the normal IPipelineBehavior.
With the addition of IAsyncEnumerable, this release now targets netstandard2.1 exclusively.
There are some breaking API changes, called out in the 10.0 migration guide.
This release contains a small, but breaking change. In order to provide a simpler interface, the IMediator interface is now split into two interfaces,…
This release contains a small, but breaking change. In order to provide a simpler interface, the IMediator interface is now split into two interfaces, a sender and publisher:
public interface ISender
{
Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default);
Task<object?> Send(object request, CancellationToken cancellationToken = default);
}
public interface IPublisher
{
Task Publish(object notification, CancellationToken cancellationToken = default);
Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default)
where TNotification : INotification;
}
public interface IMediator : ISender, IPublisher
{
}
The main motivation here is that sending should be a top-level concern of an application, but publishing can happen anywhere. This interface segregation should help catch design errors, where should never send requests from anywhere inside a request handler.
Nothing published for this version
Nothing published for this version
This is a minor release to add support for nullable reference types and target netstandard2.1 (#518).
This is a minor release to add support for nullable reference types and target netstandard2.1 (#518).
This is a patch release, the package was missing the XML documentation files.
This is a patch release, the package was missing the XML documentation files.
https://jimmybogard.com/mediatr-8-0-released/
See announcement:
https://jimmybogard.com/mediatr-8-0-released/
This release includes a small, but breaking change. Request post-processors now include the cancellation token:
This release includes a small, but breaking change. Request post-processors now include the cancellation token:
Task Process(TRequest request, TResponse response, CancellationToken cancellationToken);
This release brings a slight breaking change to the Mediator class. It adds a non-generic method overload to Publish:
This release brings a slight breaking change to the Mediator class. It adds a non-generic method overload to Publish:
public interface IMediator
{
Task<TResponse> Send<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default);
+ Task Publish(object notification, CancellationToken cancellationToken = default);
Task Publish<TNotification>(TNotification notification, CancellationToken cancellationToken = default)
where TNotification : INotification;
}
And expands the publishing possibilities for the Mediator class:
- protected virtual async Task PublishCore(IEnumerable<Task> allHandlers)
+ protected virtual async Task PublishCore(IEnumerable<Func<Task>> allHandlers)
{
foreach (var handler in allHandlers)
{
- await handler.ConfigureAwait(false);
+ await handler().ConfigureAwait(false);
}
If you've overridden the PublishCore method, check out the publishing options section in the wiki for some examples.
This release targets net461 and netstandard2.0 and adds strong-naming to the assembly. net45 and netstandard1.3 were dropped.
This release changes the default behavior of awaiting an enumerable of Task. Previous to this release, tasks where awaited using Task.WhenAll. This ca
This release changes the default behavior of awaiting an enumerable of Task. Previous to this release, tasks where awaited using Task.WhenAll. This causes problems in a variety of environments and situations that expect sequential ordering.
In this release, the default behavior for enumerables is to await in a foreach, for:
Mediator.PublishRequestPreProcessorBehaviorRequestPostProcessorBehaviorYou can override the Mediator.Publish behavior by overriding the virtual PublishCore method, while the other two you can simply replace with your own implementation.
This release consolidates some interfaces and factories. The factory delegates are now just a single delegate, ServiceFactory.
This release consolidates some interfaces and factories. The factory delegates are now just a single delegate, ServiceFactory.
Additionally, the "void" IRequest interface now inherits IRequest<Unit>, and the IRequestHandler<T> inherits IRequestHandler<T, Unit>.
Nothing published for this version
Nothing published for this version
Nothing published for this version
This release adds explicit netstandard2.0 support, which should reduce dependencies for applications targeting netstandard2.0-based frameworks (netcor
This release adds explicit netstandard2.0 support, which should reduce dependencies for applications targeting netstandard2.0-based frameworks (netcoreapp2.0 etc.)
Another small but breaking change is the behavior pipeline and pre-processor now have the cancellation token as part of the interface.
The last major release of MediatR brought a simplification in design. Instead of having several different IRequest types and IRequestHandler implementations with several flavors, MediatR would try at runtime to determine how a single IRequest should resolve to different IRequestHandler implementations (synchronous, async, async with a cancellation token). In practice, this proved problematic as not all containers support this sort of 'try-resolve' behavior. MediatR relied on try...catch to resolve, which can work, has unintended side effects.
MediatR 4.0 consolidates these design decisions. We'll still have a single IRequest type, but will now have only a single IRequestHandler interface. This simplifies the registrations quite a bit:
// Before (StructureMap)
cfg.Scan(scanner =>
{
scanner.AssemblyContainingType<Ping>();
scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<,>));
scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncRequestHandler<,>));
scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncRequestHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(ICancellableAsyncRequestHandler<,>));
scanner.ConnectImplementationsToTypesClosing(typeof(ICancellableAsyncRequestHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(INotificationHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(IAsyncNotificationHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(ICancellableAsyncNotificationHandler<>));
});
// After
cfg.Scan(scanner =>
{
scanner.AssemblyContainingType<Ping>();
scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<,>));
scanner.ConnectImplementationsToTypesClosing(typeof(IRequestHandler<>));
scanner.ConnectImplementationsToTypesClosing(typeof(INotificationHandler<>));
});
This new default interface is the previous ICancellableAsyncRequestHandler interface:
public interface IRequestHandler<in TRequest, TResponse>
where TRequest : IRequest<TResponse>
{
Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken);
}
public interface IRequestHandler<in TRequest>
where TRequest : IRequest
{
Task Handle(TRequest message, CancellationToken cancellationToken);
}
Instead of multiple interfaces, MediatR 4.0 (re)introduces helper base classes:
With the simplified interfaces, it's much less possible to "forget" a registration in your container.
Another small but breaking change is the behavior pipeline and pre-processor now have the cancellation token as part of the interface.
Both the MediatR and MediatR.Extensions.Microsoft.DependencyInjection packages are released with the simplified API.
Since these are breaking changes to the API (hence the major version bump), migration to the new API is manual. However, to ease the transition, you can follow the 3.0 to 4.0 migration guide. I've also updated the docs to walk through the new classes, and the samples include the updated registrations for the major containers out there:
A big move for MediatR to break the API, but necessary to remove the complexity in multiple interfaces and registration. The only other option would be to make MediatR responsible for all registration and wiring, which is more than I want MediatR to do. The design goal of MediatR is to lean on the power of DI containers for registration, and MediatR merely resolves its interfaces.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixes a bug around instantiating constructors multiple times
Fixes a bug around instantiating constructors multiple times
This release brings a major overhaul to the API of MediatR. The IMediator interface is now async-only, supporting optional cancellation tokens. The 'A
This release brings a major overhaul to the API of MediatR. The IMediator interface is now async-only, supporting optional cancellation tokens. The 'Async' postfix was not added onto the Send/Publish method names as there are no sync overloads.
On the handler side, you no longer need to build specific request/response types for sync/async. All request/notification types are IRequest or INotification. Instead, MediatR finds the appropriate handler implementation based on IRequestHandler, IAsyncRequestHandler and ICancellableAsyncRequestHandler.
The base class for RequestHandler is gone as well, with just the interfaces remaining.
New in this release are built-in support for pipelines through behaviors, which you can find more information about in the wiki.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Removes all dependencies, adds support for cancellation tokens, and supports All The Platforms
Removes all dependencies, adds support for cancellation tokens, and supports All The Platforms
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.