A powerful and flexible mediator implementation for .NET that enables clean architecture by decoupling request/response handling.
Mediator.Net is a .NET library that implements the mediator pattern to decouple the sending of messages (like commands, queries, and events) from their handling. It solves the problem of tight coupling between components in applications by introducing a mediator that routes messages to appropriate handlers, enabling cleaner architecture and better testability.
.NET developers building applications with clean architecture, domain-driven design, or those needing to separate business logic from infrastructure concerns like ASP.NET Core web APIs or backend services.
Developers choose Mediator.Net for its powerful pipeline support, streaming capabilities, and seamless integration with popular dependency injection containers, providing a flexible and extensible foundation for implementing the mediator pattern in .NET applications.
A simple mediator for .Net for sending command, publishing event and request response with pipelines supported
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports five distinct pipeline types (e.g., GlobalReceive, CommandReceive) for fine-grained control over cross-cutting concerns like logging and validation, as detailed in the pipeline architecture diagram.
Integrates IAsyncEnumerable for handlers to stream multiple responses, enabling efficient handling of large datasets or real-time scenarios, with clear examples in the streaming responses section.
Offers built-in packages for popular IoC containers like Microsoft.Extensions.DependencyInjection and Autofac, simplifying dependency management without manual wiring, as shown in the dependency injection integration examples.
Enforces separation of concerns through distinct interfaces for commands, queries, and events, promoting testable and maintainable code, evident in the handler registration and usage examples.
Requires explicit builder patterns and pipeline configurations for even basic setups, which can be more complex and error-prone compared to convention-based alternatives like MediatR.
While it has official middleware packages, the community support and third-party extensions are less extensive than established competitors, potentially increasing development time for custom integrations.
The multiple pipeline types, context services, and middleware specifications demand a deep understanding of mediator patterns, which may overwhelm developers new to clean architecture.