fix: 修复数据库与SignalR无法连接的问题

This commit is contained in:
2025-08-15 13:02:56 +08:00
parent 6fa7fffa7f
commit a00cc84e48
20 changed files with 78 additions and 123 deletions

View File

@@ -18,16 +18,11 @@ public class DataController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly Database.UserManager _userManager;
private readonly Database.UserManager _userManager = new();
// 固定的实验板IP,端口,MAC地址
private const string BOARD_IP = "169.254.109.0";
public DataController(Database.UserManager userManager)
{
_userManager = userManager;
}
/// <summary>
/// 获取本机IP地址优先选择与实验板同网段的IP
/// </summary>

View File

@@ -15,12 +15,7 @@ public class DebuggerController : ControllerBase
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly Database.UserManager _userManager;
public DebuggerController(Database.UserManager userManager)
{
this._userManager = userManager;
}
private readonly Database.UserManager _userManager = new();
/// <summary>
/// 获取当前用户绑定的调试器实例

View File

@@ -15,19 +15,9 @@ public class ExamController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly ExamManager _examManager;
private readonly ResourceManager _resourceManager;
private readonly UserManager _userManager;
public ExamController(
ExamManager examManager,
ResourceManager resourceManager,
UserManager userManager)
{
_examManager = examManager;
_resourceManager = resourceManager;
_userManager = userManager;
}
private readonly ExamManager _examManager = new();
private readonly ResourceManager _resourceManager = new();
private readonly UserManager _userManager = new();
/// <summary>
/// 获取所有实验列表

View File

@@ -14,12 +14,11 @@ public class HdmiVideoStreamController : ControllerBase
private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly HttpHdmiVideoStreamService _videoStreamService;
private readonly Database.UserManager _userManager;
private readonly Database.UserManager _userManager = new();
public HdmiVideoStreamController(HttpHdmiVideoStreamService videoStreamService, Database.UserManager userManager)
public HdmiVideoStreamController(HttpHdmiVideoStreamService videoStreamService)
{
_videoStreamService = videoStreamService;
_userManager = userManager;
}
// 管理员获取所有板子的 endpoints

View File

@@ -17,17 +17,14 @@ public class JtagController : ControllerBase
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly ProgressTrackerService _tracker;
private readonly UserManager _userManager;
private readonly ResourceManager _resourceManager;
private readonly UserManager _userManager = new();
private readonly ResourceManager _resourceManager = new();
private const string BITSTREAM_PATH = "bitstream/Jtag";
public JtagController(
ProgressTrackerService tracker, UserManager userManager, ResourceManager resourceManager)
public JtagController(ProgressTrackerService tracker)
{
_tracker = tracker;
_userManager = userManager;
_resourceManager = resourceManager;
}
/// <summary>

View File

@@ -15,12 +15,7 @@ public class LogicAnalyzerController : ControllerBase
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly Database.UserManager _userManager;
public LogicAnalyzerController(Database.UserManager userManager)
{
_userManager = userManager;
}
private readonly Database.UserManager _userManager = new();
/// <summary>
/// 获取逻辑分析仪实例

View File

@@ -15,12 +15,7 @@ public class OscilloscopeApiController : ControllerBase
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly Database.UserManager _userManager;
public OscilloscopeApiController(Database.UserManager userManager)
{
_userManager = userManager;
}
private readonly Database.UserManager _userManager = new();
/// <summary>
/// 获取示波器实例

View File

@@ -15,14 +15,8 @@ public class ResourceController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly UserManager _userManager;
private readonly ResourceManager _resourceManager;
public ResourceController(UserManager userManager, ResourceManager resourceManager)
{
_userManager = userManager;
_resourceManager = resourceManager;
}
private readonly UserManager _userManager = new();
private readonly ResourceManager _resourceManager = new();
/// <summary>
/// 添加资源(文件上传)

View File

@@ -18,7 +18,7 @@ public class VideoStreamController : ControllerBase
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private readonly HttpVideoStreamService _videoStreamService;
private readonly Database.UserManager _userManager;
private readonly Database.UserManager _userManager = new();
public class AvailableResolutionsResponse
{
@@ -32,13 +32,10 @@ public class VideoStreamController : ControllerBase
/// 初始化HTTP视频流控制器
/// </summary>
/// <param name="videoStreamService">HTTP视频流服务</param>
/// <param name="userManager">用户管理服务</param>
public VideoStreamController(
HttpVideoStreamService videoStreamService, Database.UserManager userManager)
public VideoStreamController(HttpVideoStreamService videoStreamService)
{
logger.Info("创建VideoStreamController命名空间{Namespace}", this.GetType().Namespace);
_videoStreamService = videoStreamService;
_userManager = userManager;
}
private Optional<string> TryGetBoardId()