namespace MxGateway.Server.Alarms; /// Service-collection wiring for the gateway's central alarm monitor. public static class AlarmsServiceCollectionExtensions { /// /// Registers the always-on as both /// the singleton and a hosted /// service, so it starts with the gateway host and is shared by the /// gRPC alarm surface and the dashboard. /// /// Service collection to register services in. /// The service collection for chaining. public static IServiceCollection AddGatewayAlarms(this IServiceCollection services) { services.AddSingleton(); services.AddSingleton(provider => provider.GetRequiredService()); services.AddHostedService(provider => provider.GetRequiredService()); return services; } }