Class AutoRegisterServiceBootstrap
Boot-time discovery of project services: finds every class marked
AutoRegisterServiceAttribute across the loaded assemblies and invokes its
public static void Install(IServiceLocator) method, so a game's services self-register into the
locator with no scene component. Mirrors the [AutoRegisterEventAction] discovery; each installer
runs in its own try/catch so one bad service can never abort boot.
Inherited Members
Namespace: Serenity.ServiceLocator.Application
Assembly: Serenity.Global.Application.dll
Syntax
public static class AutoRegisterServiceBootstrap
Fields
InstallMethodName
Name of the static method each decorated installer must expose.
Declaration
public const string InstallMethodName = "Install"
Field Value
| Type | Description |
|---|---|
| string |
Methods
DiscoverServiceInstallers()
All non-abstract classes carrying AutoRegisterServiceAttribute.
Declaration
public static IEnumerable<Type> DiscoverServiceInstallers()
Returns
| Type | Description |
|---|---|
| IEnumerable<Type> |
InstallAll(IServiceLocator, Action<string>)
Discovers and runs every AutoRegisterServiceAttribute installer against the locator.
Declaration
public static int InstallAll(IServiceLocator locator, Action<string> onError = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceLocator | locator | The service locator the installers register into. |
| Action<string> | onError | Optional sink for per-installer errors (kept engine-agnostic; the caller logs). |
Returns
| Type | Description |
|---|---|
| int | The number of installers that ran successfully. |
InstallTypes(IEnumerable<Type>, IServiceLocator, Action<string>)
Runs the given installer types (each expected to expose public static void Install(IServiceLocator))
against the locator. Split from discovery so the invocation logic is unit-testable with explicit types.
Declaration
public static int InstallTypes(IEnumerable<Type> installerTypes, IServiceLocator locator, Action<string> onError = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Type> | installerTypes | The installer types to run. |
| IServiceLocator | locator | The service locator the installers register into. |
| Action<string> | onError | Optional sink for per-installer errors. |
Returns
| Type | Description |
|---|---|
| int | The number of installers that ran successfully. |