Class AutoRegisterServiceAttribute
Marks a project class for automatic service registration at boot. The decorated class must expose a
public static void Install(IServiceLocator locator) method; Serenity discovers it by reflection
during bootstrap and invokes it, so the game's services self-register into the
IServiceLocator with no scene component or Inspector wiring.
Implements
Inherited Members
Namespace: Serenity.ServiceLocator.Application
Assembly: Serenity.Global.Application.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class AutoRegisterServiceAttribute : Attribute, _Attribute
Remarks
The counterpart to [AutoRegisterEventAction] for services. Usage:
[AutoRegisterService]
public static class GameServicesInstaller
{
public static void Install(IServiceLocator locator)
{
locator.Register<IGameStateService>(new GameStateService());
}
}
Constructors
AutoRegisterServiceAttribute()
Declaration
public AutoRegisterServiceAttribute()