VOOZH about

URL: https://www.nuget.org/packages/Mediatr/

⇱ NuGet Gallery | MediatR 14.1.0



dotnet add package MediatR --version 14.1.0
 
 
NuGet\Install-Package MediatR -Version 14.1.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="MediatR" Version="14.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MediatR" Version="14.1.0" />
 
Directory.Packages.props
<PackageReference Include="MediatR" />
 
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 MediatR --version 14.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MediatR, 14.1.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 MediatR@14.1.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=MediatR&version=14.1.0
 
Install as a Cake Addin
#tool nuget:?package=MediatR&version=14.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MediatR

👁 CI
👁 NuGet
👁 NuGet
👁 MyGet (dev)

Simple mediator implementation in .NET

In-process messaging with no dependencies.

Supports request/response, commands, queries, notifications and events, synchronous and async with intelligent dispatching via C# generic variance.

Examples in the wiki.

Installing MediatR

You should install MediatR with NuGet:

Install-Package MediatR

Or via the .NET Core command line interface:

dotnet add package MediatR

Either commands, from Package Manager Console or .NET Core CLI, will download and install MediatR and all required dependencies.

Using Contracts-Only Package

To reference only the contracts for MediatR, which includes:

  • IRequest (including generic variants)
  • INotification
  • IStreamRequest

Add a package reference to MediatR.Contracts

This package is useful in scenarios where your MediatR contracts are in a separate assembly/project from handlers. Example scenarios include:

  • API contracts
  • GRPC contracts
  • Blazor

Registering with IServiceCollection

MediatR supports Microsoft.Extensions.DependencyInjection.Abstractions directly. To register various MediatR services and handlers:

services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<Startup>());

or with an assembly:

services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(Startup).Assembly));

This registers:

  • IMediator as transient
  • ISender as transient
  • IPublisher as transient
  • IRequestHandler<,> concrete implementations as transient
  • IRequestHandler<> concrete implementations as transient
  • INotificationHandler<> concrete implementations as transient
  • IStreamRequestHandler<> concrete implementations as transient
  • IRequestExceptionHandler<,,> concrete implementations as transient
  • IRequestExceptionAction<,>) concrete implementations as transient

This also registers open generic implementations for:

  • INotificationHandler<>
  • IRequestExceptionHandler<,,>
  • IRequestExceptionAction<,>

To register behaviors, stream behaviors, pre/post processors:

services.AddMediatR(cfg => {
 cfg.RegisterServicesFromAssembly(typeof(Startup).Assembly);
 cfg.AddBehavior<PingPongBehavior>();
 cfg.AddStreamBehavior<PingPongStreamBehavior>();
 cfg.AddRequestPreProcessor<PingPreProcessor>();
 cfg.AddRequestPostProcessor<PingPongPostProcessor>();
 cfg.AddOpenBehavior(typeof(GenericBehavior<,>));
 });

With additional methods for open generics and overloads for explicit service types.

Setting the license key

You can set the license key when registering MediatR:

services.AddMediatR(cfg => 
{
 cfg.LicenseKey = "<license key here>";
})

Or if not using Microsoft.Extensions.DependencyInjection:

Mediator.LicenseKey = "<license key here>";

The license key does not need to be set on client applications (such as Blazor WASM). Turn off the license warning by configuring logging in your logging start configuration: builder.Logging.AddFilter("LuckyPennySoftware.MediatR.License", LogLevel.None);

You can register for your license key at MediatR.io

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 is compatible.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2.6K)

Showing the top 5 NuGet packages that depend on MediatR:

Package Downloads
MediatR.Extensions.Microsoft.DependencyInjection

MediatR extensions for ASP.NET Core

MediatR.Extensions.Autofac.DependencyInjection

An extension for Autofac-IoC to use MediatR and CQRS with ease.

TIKSN-Framework

TIKSN Framework is a .NET 10 application framework and utility library for building modular services, command-line tools, data-driven applications, and .NET MAUI apps. It includes dependency injection helpers, Autofac modules, repository, query repository, file repository, stream repository, pagination, unit-of-work abstractions, Entity Framework Core, Azure Table Storage, Azure Blob Storage, MongoDB, LiteDB, and RavenDB adapters, memory, distributed, and hybrid repository cache decorators, finance and money types, pricing models, currency conversion, central-bank foreign exchange providers, globalization, language and region localization resources, JSON, XML, MessagePack, custom binary serialization, Protocol Buffers-backed licensing schema support, license generation and signature services, shell and PowerShell application infrastructure, telemetry abstractions, correlation IDs, settings, known folders, network connectivity, antimalware abstractions, versioning, numbering, time period types, REST helpers, sitemap models, and platform-specific MAUI registrations.

Elsa.Core

Elsa is a set of workflow libraries and tools that enable lean and mean workflowing capabilities in any .NET Core application. This package contains the core of Elsa. Tip: reference the `Elsa` package instead of this one.

MediatR.Extensions.FluentValidation.AspNetCore

MediatR extension to FluentValidation for .NET framework.

GitHub repositories (221)

Showing the top 20 popular GitHub repositories that depend on MediatR:

Repository Stars
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
kgrzybek/modular-monolith-with-ddd
Full Modular Monolith application with Domain-Driven Design approach.
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, now community supported: https://github.com/NimblePros/eShopOnWeb
dotnet/eShop
A reference .NET application implementing an eCommerce site
MassTransit/MassTransit
Distributed Application Framework for .NET
ChilliCream/graphql-platform
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE.
jasontaylordev/NorthwindTraders
Northwind Traders is a sample application built using ASP.NET Core and Entity Framework Core.
dotnetcore/Util
Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。
simplcommerce/SimplCommerce
A simple, cross platform, modulith ecommerce system built on .NET
oskardudycz/EventSourcing.NetCore
Examples and Tutorials of Event Sourcing in .NET
martinothamar/Mediator
A high performance implementation of Mediator pattern in .NET using source generators.
fullstackhero/blazor-starter-kit
Clean Architecture Template for Blazor WebAssembly Built with MudBlazor Components.
discord-net/Discord.Net
An unofficial .Net wrapper for the Discord API (https://discord.com/)
evolutionary-architecture/evolutionary-architecture-by-example
Navigate the complex landscape of .NET software architecture with our step-by-step, story-like guide. Unpack the interplay between modular monoliths, microservices, domain-driven design, and various architectural patterns. Go beyond the one-size-fits-all solutions and understand how to blend these approaches based on your unique needs.
aspnetrun/run-aspnetcore-microservices
Microservices on .NET platforms used ASP.NET Web API, Docker, RabbitMQ, MassTransit, Grpc, Yarp API Gateway, PostgreSQL, Redis, SQLite, SqlServer, Marten, Entity Framework Core, CQRS, MediatR, DDD, Vertical and Clean Architecture implementation with using latest features of .NET 8 and C# 12
kgrzybek/sample-dotnet-core-cqrs-api
Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.
ErsatzTV/legacy
Open-source platform that transforms your personal media library into live, custom TV channels.
thepirat000/Audit.NET
An extensible framework to audit executing operations in .NET
altmann/FluentResults
A generalised Result object implementation for .NET/C#
vietnam-devs/coolstore-microservices
A full-stack .NET microservices build on Dapr and Tye
Version Downloads Last Updated
14.1.0 2,851,369 3/3/2026
14.0.0 2,743,901 12/3/2025
14.0.0-beta-1 6,356 11/20/2025
13.1.0 1,702,378 10/24/2025
13.0.0 3,925,258 7/2/2025
12.5.0 32,197,373 4/1/2025
12.4.1 54,780,610 9/9/2024
12.4.0 10,555,164 7/23/2024
12.3.0 11,967,511 6/6/2024
12.2.0 40,881,334 11/17/2023
12.1.1 23,472,138 7/10/2023
12.0.1 22,738,627 2/23/2023
11.1.0 18,609,374 11/19/2022
11.0.0 25,388,921 9/30/2022
10.0.1 43,633,756 1/10/2022
10.0.0 1,290,031 1/6/2022
9.0.0 74,046,766 10/8/2020
Loading failed