依赖注入顺序修改

This commit is contained in:
hsc
2026-06-11 10:42:00 +08:00
parent 420ca0ffd6
commit 9c661200b9
6 changed files with 27 additions and 32 deletions

View File

@@ -17,7 +17,6 @@ namespace UIShare.GlobalVariable
public class DeviceManager
{
public SystemConfig _systemConfig { get; set; }
public IList<IBaseInterface> DeviceList { get; private set; } = new List<IBaseInterface>();
/// <summary>按 DeviceName 索引的设备字典,便于业务层按名取实例。</summary>
public IDictionary<string, IBaseInterface> DeviceMap { get; private set; }
@@ -30,6 +29,7 @@ namespace UIShare.GlobalVariable
{
_systemConfig = systemConfig;
InitDevices();
}
/// <summary>
@@ -83,8 +83,6 @@ namespace UIShare.GlobalVariable
LoggerHelper.Warn($"设备 [{config.DeviceName}] 连接方式 [{config.ConnectionType}] 不支持,已跳过。");
continue;
}
DeviceList.Add(instance);
if (!string.IsNullOrWhiteSpace(config.DeviceName))
{
DeviceMap[config.DeviceName] = instance;