test per sendDataItem + enabled con scopeFactory

This commit is contained in:
Samuele Locatelli
2026-04-24 07:18:28 +02:00
parent e8ea4c5815
commit 3cb955fcb7
6 changed files with 23 additions and 8 deletions
+17 -3
View File
@@ -3,6 +3,7 @@ using MP.Core.Conf;
using MP.Core.DTO;
using MP.Core.Objects;
using MP.Data;
using MP.Data.Controllers;
using MP.Data.DbModels;
using MP.Data.DbModels.Anag;
using MP.Data.MgModels;
@@ -43,6 +44,8 @@ namespace MP.IOC.Data
int.TryParse(_configuration.GetValue<string>("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
int.TryParse(_configuration.GetValue<string>("ServerConf:redisShortTimeCache"), out redisShortTimeCache);
// gestione scope factory
useFactory = _configuration.GetValue<bool>("ServerConf:useFactory");
// conf base x servizi condivisi IO/IOC
MpIoNS = _configuration.GetValue<string>("ServerConf:MpIoNS") ?? "MP";
@@ -3765,7 +3768,7 @@ namespace MP.IOC.Data
{
bool answ = false;
if (false)
if (useFactory)
{
await using var scope = _scopeFactory.CreateAsyncScope();
var mtcService = scope.ServiceProvider.GetRequiredService<IMtcSetupService>();
@@ -4190,6 +4193,8 @@ namespace MP.IOC.Data
private int redisShortTimeCache = 2;
private bool useFactory = false;
/// <summary>
/// Generatore random classe
/// </summary>
@@ -4529,8 +4534,17 @@ namespace MP.IOC.Data
private async Task<Dictionary<string, string>> ResetDatiMacchinaAsync(string idxMacc)
{
Dictionary<string, string> result = new Dictionary<string, string>();
var dbResult = await IocDbController.VMSFDGetByMaccAsync(idxMacc);
VMSFDModel? dbResult = null;
if (useFactory)
{
await using var scope = _scopeFactory.CreateAsyncScope();
var mtcService = scope.ServiceProvider.GetRequiredService<MpIocController>();
dbResult = await mtcService.VMSFDGetByMaccAsync(idxMacc);
}
else
{
dbResult = await IocDbController.VMSFDGetByMaccAsync(idxMacc);
}
if (dbResult == null) return new Dictionary<string, string>();
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2604.2319</Version>
<Version>6.16.2604.2407</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 6.16.2604.2319</h4>
<h4>Versione: 6.16.2604.2407</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2604.2319
6.16.2604.2407
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2604.2319</version>
<version>6.16.2604.2407</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -1
View File
@@ -86,7 +86,8 @@
"RoutePath": "/api/RIOB",
"SafePages": "Index",
"redisLongTimeCache": 60,
"redisShortTimeCache": 30
"redisShortTimeCache": 30,
"useFactory": true
},
"RedisScripts": {
"Scripts": {