Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the
Lkhsoft.Dring.Server
project, focusing on refactoring the dependency injection and improving session management. The most important changes include replacing theISessionService
withIContextAccessor
, updating constructors to use dependency injection, and modifying session handling in theProgram
class.Dependency Injection and Session Management:
Lkhsoft.Dring.Server/Cli/CommandParser.cs
: ReplacedISessionService
withIContextAccessor
, added methods for session management, and updated theParseAndExecute
method to use the new context accessor. [1] [2] [3] [4] [5]Lkhsoft.Dring.Server/Cli/Commands/Authentication/LogoffCommand.cs
: Changed theIContextAccessor
field to be readonly and initialized it using an importing constructor. [1] [2] [3]Lkhsoft.Dring.Server/Cli/Commands/Authentication/LogonCommand.cs
: Updated to use dependency injection forIContextAccessor
and removed the session start call. [1] [2]Lkhsoft.Dring.Server/Program.cs
: RemovedCurrentSession
, updated session handling in theRunSession
method, and modified the shutdown handler to clear all sessions. [1] [2] [3] [4] [5] [6]Other Refactoring:
Lkhsoft.Dring.Server/Cli/Commands/CommandBase.cs
: Added logger import.Lkhsoft.Dring.Server/Cli/Commands/ExitCommand.cs
: Added security check for session service and updated constructor. [1] [2]Lkhsoft.Dring.Server/Cli/Commands/HelpCommand.cs
: Updated to use dependency injection forIContextAccessor
and command imports.Lkhsoft.Dring.Server/Cli/Commands/ISPFCommand.cs
: Updated to use dependency injection forBatchConfigLoader
and refactored batch job methods. [1] [2] [3]Lkhsoft.Dring.Server/Lua/LuaExecutor.cs
: Updated to use dependency injection for Lua delegates and refactored the function registration method.These changes improve the maintainability and testability of the code by leveraging dependency injection and better session management practices.