Loosely Coupled by Default
Every interaction flows through messages, so components never call each other directly. Change, replace, or remove any handler without ripple effects across your codebase.
Easy to maintain, easy to test, and blazingly fast β a convention-based mediator powered by source generators and interceptors
Create a simple handler by following naming conventions:
public record Ping(string Text);
public class PingHandler
{
public string Handle(Ping msg) => $"Pong: {msg.Text}";
}Register the mediator and use it:
// Program.cs
services.AddMediator();
// Usage
var reply = await mediator.InvokeAsync<string>(new Ping("Hello"));
// Output: "Pong: Hello"Turn your message handlers into API endpoints automatically:
app.MapMediatorEndpoints();
// That's it β routes, methods, and parameter binding are all generated for you.