FastMediatR.Telemetry 0.1.0

dotnet add package FastMediatR.Telemetry --version 0.1.0
                    
NuGet\Install-Package FastMediatR.Telemetry -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FastMediatR.Telemetry" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastMediatR.Telemetry" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="FastMediatR.Telemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FastMediatR.Telemetry --version 0.1.0
                    
#r "nuget: FastMediatR.Telemetry, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FastMediatR.Telemetry@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FastMediatR.Telemetry&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=FastMediatR.Telemetry&version=0.1.0
                    
Install as a Cake Tool

FastMediatR

High-performance, AOT-friendly, MIT-licensed in-process mediator for .NET 10 with a public API that is a near drop-in replacement for MediatR.

License: MIT

FastMediatR uses a Roslyn IIncrementalGenerator to emit zero-reflection dispatch code at compile time. The result: faster Send/Publish, fewer allocations, and full Native-AOT/trimming compatibility.

Status: Pre-1.0 — actively under construction. Public APIs may shift until v1.0.0 is tagged.

Features

  • Zero-reflection dispatch — a source generator emits a switch-based dispatcher at compile time; no MethodInfo, no dynamic, no runtime type scanning on the hot path.
  • Native AOT & trimming friendly — ships IsAotCompatible=true and IsTrimmable=true; the only reflection touchpoint is a one-time startup lookup that has a fully trim-safe alternative.
  • Near drop-in for MediatRIRequest<T>, IRequestHandler<,>, INotification, INotificationHandler<>, ISender, IPublisher, IMediator, and IPipelineBehavior<,> mirror the MediatR surface (see the migration guide).
  • Build-time wiring validation — diagnostics FM001 (no handler) and FM002 (duplicate handler) fail the build before you run; FM003 flags non-default handler lifetimes.
  • Built-in pipeline behaviorsValidationBehavior (FluentValidation), LoggingBehavior, and PerformanceBehavior, plus pre-/post-processors.
  • Configurable notification publishingTaskWhenAllPublisher (default, concurrent) and SequentialAwaitPublisher (ordered, fail-fast).
  • Optional OpenTelemetry tracing via the FastMediatR.Telemetry package.

Quick start

Define requests and handlers:

using FastMediatR;

public sealed record CreateUserCommand(string Email, string DisplayName) : IRequest<Guid>;

public sealed class CreateUserCommandHandler : IRequestHandler<CreateUserCommand, Guid>
{
    public Task<Guid> Handle(CreateUserCommand request, CancellationToken cancellationToken)
        => Task.FromResult(Guid.NewGuid());
}

Register in Program.cs and dispatch:

using FastMediatR.Extensions.DI;

builder.Services.AddFastMediatR<Program>();

app.MapPost("/users", async (CreateUserCommand command, IMediator mediator, CancellationToken ct) =>
{
    var id = await mediator.Send(command, ct);
    return Results.Created($"/users/{id}", new { id });
});

See the usage guide for DI options, pipeline behaviors, AOT guidance, and MediatR migration.

Project layout

Project Purpose
src/FastMediatR.Core Core abstractions, built-in behaviors, notification publishers, options.
src/FastMediatR.Generator Roslyn incremental generator (dispatcher + DI registration).
src/FastMediatR.Extensions.DI AddFastMediatR<TMarker>() entry point and assembly scanning.
src/FastMediatR.Telemetry Optional OpenTelemetry tracing behavior.
samples/FastMediatR.Sample.Api Reference minimal-API sample wired end-to-end.

Build

dotnet build FastMediatR.slnx
dotnet test  FastMediatR.slnx

Requires the .NET 10 SDK (see global.json). The canonical solution file is FastMediatR.slnx.

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 42 5/29/2026