DispatcherRegistrations
Namespace: RA.Utilities.Dispatcher.Generated
DispatcherRegistrations is the runtime-side queue that carries the registration of the generated Dispatcher — 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 AddDispatcher() drains it.
📦 Type Definition
public static class DispatcherRegistrations
{
public static void Add(Action<IServiceCollection> registration);
internal static void ApplyAll(IServiceCollection services);
}
🎯 How It Works
- At compile time, the source generator emits the
Dispatcherclass (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,
AddDispatcher()applies the queued registration, so:IDispatcherresolves to the generatedDispatcher,Dispatcheris 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). Unlike HandlerRegistrations, it is applied unconditionally — DispatcherOptions filters handlers and behaviors only, never the generated dispatcher itself.
Each referencing assembly queues its own generated Dispatcher — the registration of the last loaded assembly wins. Every assembly's generated dispatcher covers the messages visible to that assembly's compilation, including its referenced libraries. See Generated Dispatcher for the dispatch matrix.
🔗 Related
- Generated Dispatcher — the dispatch strategy, object-based dispatch, and message/handler diagnostics (
DSAG006–DSAG009). HandlerRegistrations— the sibling queue for handler and behavior registrations.