Reimaginate.Mediator.SourceGenerator
1.3.0-rc.8
dotnet add package Reimaginate.Mediator.SourceGenerator --version 1.3.0-rc.8
NuGet\Install-Package Reimaginate.Mediator.SourceGenerator -Version 1.3.0-rc.8
<PackageReference Include="Reimaginate.Mediator.SourceGenerator" Version="1.3.0-rc.8" />
<PackageVersion Include="Reimaginate.Mediator.SourceGenerator" Version="1.3.0-rc.8" />
<PackageReference Include="Reimaginate.Mediator.SourceGenerator" />
paket add Reimaginate.Mediator.SourceGenerator --version 1.3.0-rc.8
#r "nuget: Reimaginate.Mediator.SourceGenerator, 1.3.0-rc.8"
#:package Reimaginate.Mediator.SourceGenerator@1.3.0-rc.8
#addin nuget:?package=Reimaginate.Mediator.SourceGenerator&version=1.3.0-rc.8&prerelease
#tool nuget:?package=Reimaginate.Mediator.SourceGenerator&version=1.3.0-rc.8&prerelease
Reimaginate.Mediator.SourceGenerator
Roslyn source generator for Reimaginate Mediator.
This package emits concrete mediator implementations with generated request dispatch plans and handler/validator registrations. Reference it as an analyzer package when using [Mediator] and [ScanAssembly].
Basic usage
using Microsoft.Extensions.DependencyInjection;
using Reimaginate.Mediator;
[Mediator]
[ScanAssembly(typeof(CreateOrderHandler))]
public partial class AppMediator
{
}
var services = new ServiceCollection();
AppMediator.RegisterHandlers(services);
services.AddScoped<IMediator, AppMediator>();
RegisterHandlers registers generated handler and validator services. It does not register the generated mediator itself as IMediator.
Cached mode
Generated mediators resolve handlers and validators from DI per send by default. To opt into per-mediator-instance caching for known closed handlers and generated validators, set CacheResolvedServices on the mediator attribute:
[Mediator(CacheResolvedServices = true)]
[ScanAssembly(typeof(CreateOrderHandler))]
public partial class AppMediator
{
}
With that attribute, normal DI activation uses cached mode:
AppMediator.RegisterHandlers(services);
services.AddScoped<IMediator, AppMediator>();
You can still override the attribute default directly:
var cached = new AppMediator(serviceProvider, cacheResolvedServices: true);
var uncached = new AppMediator(serviceProvider, cacheResolvedServices: false);
Cached mode is lock-free. Cached handlers and validators may be invoked concurrently by parallel sends. Use it only when cached handlers, validators, and their dependencies are safe for the mediator lifetime and concurrent use. Prefer scoped mediator registration when cached dependencies are scoped; use singleton mediator registration only when every cached dependency is singleton-safe and thread-safe.
Generated handler and validator lifetimes can be selected explicitly:
AppMediator.RegisterHandlers(
services,
handlerLifetime: ServiceLifetime.Scoped,
validatorLifetime: ServiceLifetime.Scoped);
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Reimaginate.Mediator.SourceGenerator:
| Package | Downloads |
|---|---|
|
Reimaginate.DataHub
Core DataHub runtime for request handling, data operations, validation, telemetry, and persistence integration. |
|
|
Reimaginate.Orchestrator.Common
Core Orchestrator runtime services, workflow execution, persistence helpers, and transitive workflow action generation support. |
|
|
Reimaginate.CLI.Microsoft.ACS.Tools
Package Description |
|
|
Reimaginate.CLI.Microsoft.CRM.Tools
Package Description |
|
|
Reimaginate.DataHub.GoogleAnalyticsAgent
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.0-rc.8 | 0 | 5/21/2026 |
| 1.3.0-rc.7 | 0 | 5/21/2026 |
| 1.3.0-rc.6 | 41 | 5/21/2026 |
| 1.3.0-rc.5 | 30 | 5/20/2026 |
| 1.3.0-rc.4 | 57 | 5/20/2026 |
| 1.3.0-rc.3 | 44 | 5/20/2026 |
| 1.3.0-rc.2 | 46 | 5/20/2026 |
| 1.3.0-rc.1 | 37 | 5/19/2026 |
| 1.2.6-rc.8 | 90 | 5/18/2026 |
| 1.2.6-rc.7 | 53 | 5/18/2026 |
| 1.2.6-rc.3 | 41 | 5/18/2026 |
| 1.2.6-rc.2 | 41 | 5/18/2026 |
| 1.2.6-rc.1 | 48 | 5/18/2026 |
| 1.2.5 | 648 | 2/26/2026 |
| 1.2.4 | 101 | 2/26/2026 |
| 1.2.3 | 488 | 9/7/2025 |
| 1.2.2 | 384 | 6/26/2025 |
| 1.2.1 | 206 | 6/26/2025 |
| 1.2.0 | 208 | 6/26/2025 |
| 1.2.0-preview4 | 393 | 6/12/2025 |