diff --git a/Server/AuthSession.cs b/Server/AuthSession.cs index ad1c06f..9c33a07 100644 --- a/Server/AuthSession.cs +++ b/Server/AuthSession.cs @@ -8,7 +8,7 @@ namespace Server; public abstract class AuthSession : TcpSession { - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly IMediator _mediator; private static readonly byte[] Key = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7 } @@ -21,7 +21,7 @@ public abstract class AuthSession : TcpSession private readonly ICryptoTransform _decryptor; protected AuthSession(TcpServer - server, ILogger logger, IMediator mediator) : base(server) + server, ILogger logger, IMediator mediator) : base(server) { _logger = logger; _mediator = mediator; diff --git a/Server/Services/WonderkingAuthServer.cs b/Server/Services/WonderkingAuthServer.cs index 2044e7a..2b16dd8 100644 --- a/Server/Services/WonderkingAuthServer.cs +++ b/Server/Services/WonderkingAuthServer.cs @@ -23,9 +23,8 @@ public class WonderkingAuthServer : TcpServer, IHostedService _loggerFactory = loggerFactory; } - protected override TcpSession CreateSession() => new WonderkingSession(this, - _serviceProvider.GetService() ?? throw new InvalidOperationException(), - _loggerFactory.CreateLogger(nameof(WonderkingSession))); + protected override TcpSession CreateSession() => + ActivatorUtilities.CreateInstance(_serviceProvider, this); protected override void OnStarting() { diff --git a/Server/WonderkingSession.cs b/Server/WonderkingSession.cs index fef4a30..2cfa63a 100644 --- a/Server/WonderkingSession.cs +++ b/Server/WonderkingSession.cs @@ -9,7 +9,7 @@ public class WonderkingSession : AuthSession { private readonly IMediator _mediator; - public WonderkingSession(TcpServer server, IMediator mediator, ILogger logger) : base(server, logger, mediator) + public WonderkingSession(TcpServer server, IMediator mediator, ILogger logger) : base(server, logger, mediator) { _mediator = mediator; }