Files
mxaccessgw/src/MxGateway.Server/Sessions/SessionServiceCollectionExtensions.cs
T

19 lines
834 B
C#

namespace MxGateway.Server.Sessions;
/// <summary>Service collection extensions for session management.</summary>
public static class SessionServiceCollectionExtensions
{
/// <summary>Registers gateway session registry, manager, and factory services.</summary>
/// <param name="services">Service collection to register services in.</param>
/// <returns>The service collection for chaining.</returns>
public static IServiceCollection AddGatewaySessions(this IServiceCollection services)
{
services.AddSingleton<ISessionRegistry, SessionRegistry>();
services.AddSingleton<ISessionWorkerClientFactory, SessionWorkerClientFactory>();
services.AddSingleton<ISessionManager, SessionManager>();
services.AddHostedService<SessionShutdownHostedService>();
return services;
}
}