A8 4G模块记录采用单例模式解决线程安全问题
This commit is contained in:
parent
2b57de55bd
commit
f78b5f5dc7
|
|
@ -1,9 +1,11 @@
|
||||||
using DotNetCore.CAP;
|
using DotNetCore.CAP;
|
||||||
|
using Furion;
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DistributedIDGenerator;
|
using Furion.DistributedIDGenerator;
|
||||||
using Furion.Logging.Extensions;
|
using Furion.Logging.Extensions;
|
||||||
using Furion.RemoteRequest.Extensions;
|
using Furion.RemoteRequest.Extensions;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
@ -297,7 +299,14 @@ namespace Waste.Application.SubscribeInfo
|
||||||
public async void InsertA84GResultAsync(A8MyPackage myPackage)
|
public async void InsertA84GResultAsync(A8MyPackage myPackage)
|
||||||
{
|
{
|
||||||
//_loggerService.AddLogger($"A8记录,内容:{myPackage.ToJson()}", 1);
|
//_loggerService.AddLogger($"A8记录,内容:{myPackage.ToJson()}", 1);
|
||||||
|
//await _resultService.InsertResultByA84GAsync(myPackage);
|
||||||
|
|
||||||
|
await Scoped.Create(async (_, scope) =>
|
||||||
|
{
|
||||||
|
var services = scope.ServiceProvider;
|
||||||
|
var _resultService = services.GetService<IResultService>();
|
||||||
await _resultService.InsertResultByA84GAsync(myPackage);
|
await _resultService.InsertResultByA84GAsync(myPackage);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ namespace Waste.Core
|
||||||
DbType = DbType.SqlServer,
|
DbType = DbType.SqlServer,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
InitKeyType = InitKeyType.Attribute //从特性读取主键自增信息
|
InitKeyType = InitKeyType.Attribute //从特性读取主键自增信息
|
||||||
},
|
}
|
||||||
|
#if DEBUG
|
||||||
|
,
|
||||||
db =>
|
db =>
|
||||||
{
|
{
|
||||||
//处理日志事务
|
//处理日志事务
|
||||||
|
|
@ -32,6 +34,7 @@ namespace Waste.Core
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue