Relevox.Contracts
1.7.0
dotnet add package Relevox.Contracts --version 1.7.0
NuGet\Install-Package Relevox.Contracts -Version 1.7.0
<PackageReference Include="Relevox.Contracts" Version="1.7.0" />
<PackageVersion Include="Relevox.Contracts" Version="1.7.0" />
<PackageReference Include="Relevox.Contracts" />
paket add Relevox.Contracts --version 1.7.0
#r "nuget: Relevox.Contracts, 1.7.0"
#:package Relevox.Contracts@1.7.0
#addin nuget:?package=Relevox.Contracts&version=1.7.0
#tool nuget:?package=Relevox.Contracts&version=1.7.0
Relevox
GitHub · Docs · Changelog · Moving from MediatR
A mediator for .NET whose dispatch is written by a source generator at build time, with the same handler signatures as MediatR 12. MIT licensed, no licence key, no telemetry.
dotnet add package Relevox # the application, which calls AddRelevox
dotnet add package Relevox.Contracts # libraries that only declare requests and handlers
dotnet add package Relevox.Testing # test projects: a fake mediator and a notification recorder
dotnet add package Relevox.FluentValidation # a validation behaviour, only for requests with a validator
dotnet add package Relevox.MediatRBridge # MediatR and Relevox side by side while a solution moves

- Same signatures as MediatR 12. Requests, notifications, streams, pipeline behaviours, pre and post
processors, exception handlers and actions. Moving over changes packages,
usingdirectives and the registration call. - Dispatch decided at build time. No assembly scanning. A request with no handler, or with two, is reported by the compiler.
- NativeAOT and trimming without annotations.
- Faster than MediatR 12.5: a send takes under half the time through
ISenderand a quarter through the generated mediator; startup takes a twenty-fifth. Every number is measured and published with the hardware named.
Packages
| Package | Reference it from |
|---|---|
Relevox |
The application, the project that calls AddRelevox. It brings the source generator. |
Relevox.Contracts |
Projects that only declare requests and handlers: domain, application, feature libraries. |
Relevox.Testing |
Test projects: a fake IMediator and a recorder for published notifications (testing.md). |
Relevox.FluentValidation |
The application, for FluentValidation validators: the build gives the behaviour only to the requests that have one (validation.md). |
Relevox.MediatRBridge |
The application, while it moves from MediatR one feature at a time: MediatR's interfaces send each message to the library that has its handler (migration.md). |
Quick start
using Relevox;
builder.Services.AddRelevox();
public sealed record GetOrder(int Id) : IRequest<Order>;
public sealed class GetOrderHandler(OrderStore store) : IRequestHandler<GetOrder, Order>
{
public Task<Order> Handle(GetOrder request, CancellationToken cancellationToken) =>
store.FindAsync(request.Id, cancellationToken);
}
// Anywhere ISender, IPublisher or IMediator is injected:
Order order = await sender.Send(new GetOrder(42), cancellationToken);
Handlers are found in the application and in every referenced project that uses Relevox.Contracts.
From MediatR 12
- Replace the
MediatRpackage withRelevoxin the application and withRelevox.Contractselsewhere. - Replace
using MediatR;withusing Relevox;andusing MediatR.Pipeline;withusing Relevox.Pipeline;. - Replace
AddMediatR(cfg => cfg.RegisterServicesFromAssembly(...))withAddRelevox(). Behaviours, processors and lifetimes are configured with the same members as before.
In an IDE, steps 2 and 3 are a code fix: after the package swap, apply Move from MediatR to Relevox to the
whole solution. From the command line it is dotnet format analyzers --diagnostics RVX0007 --severity info.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Relevox.Contracts:
| Package | Downloads |
|---|---|
|
Relevox
A mediator for .NET whose dispatch is written by a source generator at build time, with the same handler signatures as MediatR 12. MIT licensed. |
|
|
Relevox.MediatRBridge
Runs MediatR and Relevox side by side: MediatR's IMediator, ISender and IPublisher send each message to whichever library has its handler, so a solution can move to Relevox one feature at a time. |
GitHub repositories
This package is not used by any popular GitHub repositories.