MediatorRegistrations
Namespace: RA.Utilities.Dispatcher.Generated
MediatorRegistrations is the runtime-side queue that carries the registration of the generated Mediator — the source-generated IDispatcher implementation emitted into each of your assemblies. You never call it directly — the generator's module initializers enqueue into it, and AddMediator() drains it.
📦 Type Definition
public static class MediatorRegistrations
{
public static void Add(Action<IServiceCollection> registration);
internal static void ApplyAll(IServiceCollection services);
}
🎯 How It Works
- At compile time, the source generator emits the
Mediatorclass (intoRA.Utilities.Dispatcher.Generated, inside your assembly) together with a module initializer that queues its registration. - At assembly load, the module initializer runs and queues the callback.
- At startup,
AddMediator()applies the queued registration, so:IDispatcherresolves to the generatedMediator,Mediatoris registered as itself, so it can be injected directly for the fastest path.
The queue is thread-safe (a lock guards a snapshot on apply).
Assembly loading
Each referencing assembly queues its own generated Mediator — the registration of the last loaded assembly wins. Every assembly's generated mediator covers the messages visible to that assembly's compilation, including its referenced libraries. See Generated Mediator for the dispatch matrix.
🔗 Related
- Generated Mediator — the dispatch strategy, object-based dispatch, and message/handler diagnostics (
DSAG006–DSAG009). HandlerRegistrations— the sibling queue for handler and behavior registrations.