mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-21 11:08:13 +08:00
fix: 取消mapster映射忽略大小写,这会导致字典键错误
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
|
||||
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
|
||||
// 源代码使用协议遵循本仓库的开源协议及附加协议
|
||||
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
|
||||
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
|
||||
// 使用文档:https://kimdiego2098.github.io/
|
||||
// QQ群:605534569
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ThingsGateway.Foundation;
|
||||
|
||||
/// <summary>
|
||||
/// 通道配置保存
|
||||
/// </summary>
|
||||
public class ChannelConfig : AppConfigBase
|
||||
{
|
||||
public static ChannelConfig Default;
|
||||
|
||||
static ChannelConfig()
|
||||
{
|
||||
Default = AppConfigBase.GetNewDefault<ChannelConfig>();
|
||||
foreach (var item in Default.ChannelDatas)
|
||||
{
|
||||
ChannelData.CreateChannel(item);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通道列表
|
||||
/// </summary>
|
||||
public ConcurrentList<ChannelData> ChannelDatas { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
||||
/// </summary>
|
||||
public ChannelConfig() : base(($"channel.config.json"))
|
||||
{
|
||||
}
|
||||
}
|
@@ -97,7 +97,6 @@ internal class AdminTaskService : BackgroundService
|
||||
.Select(a => Path.GetFileName(a))
|
||||
.ToArray();
|
||||
|
||||
ChannelConfig channelConfig = AppConfigBase.GetNewDefault<ChannelConfig>();
|
||||
foreach (var item in debugDirs)
|
||||
{
|
||||
if (stoppingToken.IsCancellationRequested)
|
||||
@@ -107,10 +106,7 @@ internal class AdminTaskService : BackgroundService
|
||||
//删除文件夹
|
||||
try
|
||||
{
|
||||
if (!channelConfig.ChannelDatas.Select(a => a.Id.ToString()).Contains(item))
|
||||
{
|
||||
Directory.Delete(debugDir.CombinePathWithOs(item), true);
|
||||
}
|
||||
Directory.Delete(debugDir.CombinePathWithOs(item), true);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
@@ -349,7 +349,7 @@ public class PluginService : IPluginService
|
||||
foreach (var propertyInfo in pluginProperties ?? new List<PropertyInfo>())
|
||||
{
|
||||
// 在设备属性列表中查找与当前属性相同名称的属性
|
||||
if (!deviceProperties.TryGetValue(propertyInfo.Name.ToLower(), out var deviceProperty))
|
||||
if (!deviceProperties.TryGetValue(propertyInfo.Name, out var deviceProperty))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -31,11 +31,6 @@ public class Startup : AppStartup
|
||||
.NameMatchingStrategy(NameMatchingStrategy.Flexible)
|
||||
.PreserveReference(true);
|
||||
|
||||
// 配置默认全局映射(忽略大小写敏感)
|
||||
TypeAdapterConfig.GlobalSettings.Default
|
||||
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase)
|
||||
.PreserveReference(true);
|
||||
|
||||
//运行日志写入数据库配置
|
||||
services.AddDatabaseLogging<BackendLogDatabaseLoggingWriter>(options =>
|
||||
{
|
||||
|
@@ -11,6 +11,7 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using MQTTnet.AspNetCore;
|
||||
|
||||
@@ -60,7 +61,6 @@ public partial class MqttServer : BusinessBaseWithCacheIntervalScript<VariableDa
|
||||
webBuilder.UseStartup<MqttServerStartup>();
|
||||
_webHost = webBuilder.UseConfiguration(configuration)
|
||||
.Build();
|
||||
|
||||
_mqttServer = _webHost.Services.GetRequiredService<MqttHostedServer>();
|
||||
|
||||
#endregion 初始化
|
||||
@@ -68,7 +68,7 @@ public partial class MqttServer : BusinessBaseWithCacheIntervalScript<VariableDa
|
||||
|
||||
protected override async Task ProtectedBeforStartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_ = _webHost.StartAsync(cancellationToken);
|
||||
_ = _webHost.RunAsync();
|
||||
if (_mqttServer != null)
|
||||
{
|
||||
_mqttServer.ValidatingConnectionAsync -= MqttServer_ValidatingConnectionAsync;
|
||||
|
@@ -12,6 +12,7 @@ using Mapster;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using MQTTnet;
|
||||
using MQTTnet.Internal;
|
||||
|
Reference in New Issue
Block a user