Class BaseModule
Convenience base for a module's Module class. Stores the module context and re-exposes
host events, registries, and logging through Events, Registries,
and Log. Override the On* lifecycle hooks; only Manifest
is required. Subclasses that own resources before setup completes may implement
IDisposable; the host disposes them even when later lifecycle hooks are skipped.
public abstract class BaseModule : IModule
- Inheritance
-
BaseModule
- Implements
- Derived
- Inherited Members
Properties
Context
Gets the module context, available from OnSetup() onward.
protected IModuleContext Context { get; }
Property Value
Events
Gets the server event bus scoped to this module.
protected IEventBus Events { get; }
Property Value
Log
Gets the logger tagged with this module's identifier.
protected IShardLogger Log { get; }
Property Value
Manifest
Gets the module's identity and dependency declaration.
public abstract ModuleManifest Manifest { get; }
Property Value
Services
Gets the host service provider used to resolve services exposed to this module.
protected IServiceRegistry Services { get; }
Property Value
Methods
OnPreloadAsync(CancellationToken)
Performs asynchronous preload work that must complete before this module can start.
protected virtual Task OnPreloadAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token that is canceled when server startup is interrupted.
Returns
- Task
A task representing the asynchronous preload operation.
OnQuiesceAsync()
Stops new work and completes work already accepted by the module.
protected virtual Task OnQuiesceAsync()
Returns
OnSetup()
Called during synchronous module setup after the module context has been assigned.
protected virtual void OnSetup()
OnShutdown()
Called in reverse load order after quiescence. This hook is skipped if setup does not complete; use IDisposable for cleanup required on every ownership path.
protected virtual void OnShutdown()
OnStart()
Called after preload and required dependencies start. The ready event is published after all eligible start hooks and failed or blocked module cleanup finish.
protected virtual void OnStart()