Reimaginate.Mediator.SourceGenerator 1.3.0

dotnet add package Reimaginate.Mediator.SourceGenerator --version 1.3.0
                    
NuGet\Install-Package Reimaginate.Mediator.SourceGenerator -Version 1.3.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="Reimaginate.Mediator.SourceGenerator" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reimaginate.Mediator.SourceGenerator" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Reimaginate.Mediator.SourceGenerator" />
                    
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 Reimaginate.Mediator.SourceGenerator --version 1.3.0
                    
#r "nuget: Reimaginate.Mediator.SourceGenerator, 1.3.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 Reimaginate.Mediator.SourceGenerator@1.3.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=Reimaginate.Mediator.SourceGenerator&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Reimaginate.Mediator.SourceGenerator&version=1.3.0
                    
Install as a Cake Tool

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].

Generated applications can target .NET 8 or .NET 10. See the repository documentation for the complete developer guide and support information.

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);
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (12)

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.CLI.Microsoft.ACS.Tools

Azure Container Apps command handlers for deploying, exporting, replicating, inspecting, and updating container apps and jobs from Reimaginate CLI.

Reimaginate.Orchestrator.Common

Core Orchestrator runtime services, workflow execution, persistence helpers, and transitive workflow action generation support.

Reimaginate.CLI.Microsoft.CRM.Tools

Dynamics 365 and Dataverse command handlers for listing, exporting, comparing, and updating CRM assets from Reimaginate CLI.

Reimaginate.CLI.Microsoft.ServiceBus.Tools

Azure Service Bus command handlers for listing queues, resubmitting dead-letter messages, and copying namespace or queue topology from Reimaginate CLI.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 40 7/17/2026
1.3.0-rc.8 4,848 5/21/2026
1.3.0-rc.7 68 5/21/2026
1.3.0-rc.6 142 5/21/2026
1.3.0-rc.5 78 5/20/2026
1.3.0-rc.4 223 5/20/2026
1.3.0-rc.3 88 5/20/2026
1.3.0-rc.2 76 5/20/2026
1.3.0-rc.1 64 5/19/2026
1.2.6-rc.8 151 5/18/2026
1.2.6-rc.7 68 5/18/2026
1.2.6-rc.3 62 5/18/2026
1.2.6-rc.2 67 5/18/2026
1.2.6-rc.1 66 5/18/2026
1.2.5 687 2/26/2026
1.2.4 116 2/26/2026
1.2.3 507 9/7/2025
1.2.2 396 6/26/2025
1.2.1 219 6/26/2025
1.2.0 219 6/26/2025
Loading failed