Skip to content

Appearance

Foundatio MediatorBuild Loosely Coupled .NET Apps โ€” Without the Tradeoffs

Easy to maintain, easy to test, and blazingly fast โ€” a convention-based mediator powered by source generators and interceptors

Foundatio Mediator
๐Ÿ”’

Compile-Time Safety & Debugging

Comprehensive diagnostics catch errors early. Short, simple call stacks with minimal indirection make debugging straightforward.

Quick Example

Create a simple handler by following naming conventions:

csharp
public record Ping(string Text);
โ€‹
public class PingHandler
{
    public string Handle(Ping msg) => $"Pong: {msg.Text}";
}

Register the mediator and use it:

csharp
// 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:

csharp
app.MapMediatorEndpoints();
// That's it โ€” routes, methods, and parameter binding are all generated for you.