jbogard/MediatR

Created Dec 28, 2020 · View the jbogard/MediatR repository page

Simple, unambitious mediator implementation in .NET

Want this for your repo?

Render a free sample of any GitHub repo in seconds.

Visualize your own →

Contributors

64

Lines of Code

2,030

From

Mar 3, 2014

To

Dec 25, 2020

About jbogard/MediatR

MediatR is a lightweight mediator library for .NET that implements the mediator pattern for in-process messaging without external dependencies. It enables developers to decouple request handlers from their callers by routing messages through a central dispatcher, supporting multiple messaging patterns including request/response, commands, queries, notifications, and events with both synchronous and asynchronous execution.

The library uses C# generic variance for intelligent message dispatching and integrates seamlessly with Microsoft's dependency injection abstractions. Installation is straightforward via NuGet, and MediatR provides flexible registration options for handlers, behaviors, stream handlers, and exception handlers within the service collection. A contracts-only package is available separately, allowing projects to reference only the core interfaces without the full implementation, which is particularly useful for scenarios like API contracts, gRPC definitions, and Blazor applications.

MediatR is designed for .NET developers building applications that benefit from loose coupling and separation of concerns. It's especially popular in domain-driven design and CQRS architectures where command and query separation is desired. The project includes examples and documentation in its wiki, and recently introduced a commercial licensing model with optional license key registration for enhanced features.

Share this video