- fix program.cs startup
- fix calcolo dim DB
- fix IOB count
This commit is contained in:
Samuele Locatelli
2026-06-03 18:32:51 +02:00
parent febe1d0132
commit 217836099c
10 changed files with 60 additions and 22 deletions
@@ -67,6 +67,7 @@ namespace MP.Data
// Servizi LAND
services.TryAddSingleton<IMpLandRepository, MpLandRepository>();
services.TryAddSingleton<MpIocController>();
services.TryAddSingleton<SyncService>();
services.TryAddSingleton<TabDataService>();
services.TryAddSingleton<LandDataService>();
@@ -20,10 +20,16 @@ namespace MP.Data.Repository.MpLand
#region Public Constructors
public MpLandRepository(IConfiguration configuration, IDbContextFactory<MoonProContext> ctxFactory)
public MpLandRepository(
IConfiguration configuration,
IDbContextFactory<MoonProContext> ctxFactory,
IDbContextFactory<MoonPro_FluxContext> ctxFactoryFL,
IDbContextFactory<MoonPro_STATSContext> ctxFactorySta)
{
_configuration = configuration;
_ctxFactory = ctxFactory;
_ctxFactoryFluxLog = ctxFactoryFL;
_ctxFactoryStats= ctxFactorySta;
}
#endregion
+8 -8
View File
@@ -88,15 +88,15 @@ namespace MP.Data.Services
/// </summary>
/// <param name="UserName"></param>
/// <returns></returns>
public List<IobDTO> IobListAll()
public async Task<List<IobDTO>> IobListAllAsync()
{
string source = "DB";
List<IobDTO>? dbResult = new List<IobDTO>();
string currKey = $"{redisBaseKey}:IobList";
Stopwatch sw = new Stopwatch();
sw.Start();
string? rawData = _redisDb.StringGet(currKey);
if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2)
var rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<IobDTO>>(rawData);
@@ -105,10 +105,10 @@ namespace MP.Data.Services
else
{
// recupero RRL missing
var listRRl = _mpLandRepository.RemRebootLogGetLastAsync().GetAwaiter().GetResult();
var listRRlAdd = _mpLandRepository.RemRebootLogGetLastNoMaccAsync().GetAwaiter().GetResult();
var listRRl = await _mpLandRepository.RemRebootLogGetLastAsync();
var listRRlAdd = await _mpLandRepository.RemRebootLogGetLastNoMaccAsync();
// recupero lista macchine
var ListMacch = _mpLandRepository.MacchineGetAllAsync().GetAwaiter().GetResult();
var ListMacch = await _mpLandRepository.MacchineGetAllAsync();
// ...converto in DTO
dbResult = ListMacch
.Select(x => new IobDTO(x, IobInfo(x.IdxMacchina), MachIobConf(x.IdxMacchina)))
@@ -125,14 +125,14 @@ namespace MP.Data.Services
// serializzo in cache _redisConn
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
_redisDb.StringSet(currKey, rawData, UltraLongCache);
await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (dbResult == null)
{
dbResult = new List<IobDTO>();
}
sw.Stop();
Log.Debug($"IobListAll | {source} | {sw.ElapsedMilliseconds} ms");
Log.Debug($"IobListAllAsync | {source} | {sw.ElapsedMilliseconds} ms");
return dbResult;
}
+6 -4
View File
@@ -5,6 +5,7 @@ using MP.Data.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.Components
{
@@ -21,9 +22,10 @@ namespace MP.Land.Components
#region Protected Methods
protected override void OnParametersSet()
protected override async Task OnParametersSetAsync()
{
ReloadData();
await ReloadDataAsync();
}
protected void SortRequested(Sorter.SortCallBack e)
@@ -117,9 +119,9 @@ namespace MP.Land.Components
}
}
private void ReloadData()
private async Task ReloadDataAsync()
{
ListRecord = LDService.AllDbInfo();
ListRecord = await LDService.AllDbInfoAsync();
}
#endregion Private Methods
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>8.16.2606.0312</Version>
<Version>8.16.2606.0318</Version>
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
+3 -3
View File
@@ -173,11 +173,11 @@ namespace MP.Land.Pages
return answ;
}
protected void DataInit()
protected async Task DataInitAsync()
{
isLoading = true;
// recupero TUTTI i dati IobList già completi anche on i RemoteRebootLog
AllRecords = LDService.IobListAll();
AllRecords = await LDService.IobListAllAsync();
#if false
@@ -216,7 +216,7 @@ namespace MP.Land.Pages
AppMService.PageName = "IobList";
AppMService.PageIcon = "fas fa-computer pe-2";
await SetupRight();
DataInit();
await DataInitAsync();
}
protected void ResetSearch()
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo Tablet MAPO - DotNet6</i>
<h4>Versione: 8.16.2606.0312</h4>
<h4>Versione: 8.16.2606.0318</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.0312
8.16.2606.0318
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.0312</version>
<version>8.16.2606.0318</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+31 -2
View File
@@ -1,4 +1,4 @@
using Blazored.LocalStorage;
using Blazored.LocalStorage;
using Blazored.SessionStorage;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Builder;
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Localization;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -17,6 +18,10 @@ using MP.TaskMan.Services;
using StackExchange.Redis;
using System;
using System.Globalization;
using System.Threading.Tasks;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
namespace MP.Land
{
@@ -121,12 +126,22 @@ namespace MP.Land
options.FallbackPolicy = options.DefaultPolicy;
});
// REDIS setup
string connStringRedis = Configuration.GetConnectionString("Redis");
string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
IConnectionMultiplexer redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
// ✅ FusionCache
services.AddFusionCache()
.WithDistributedCache(sp => sp.GetRequiredService<IDistributedCache>())
.WithSerializer(new FusionCacheNewtonsoftJsonSerializer())
.WithBackplane(new RedisBackplane(new RedisBackplaneOptions
{
ConnectionMultiplexerFactory = () => Task.FromResult(redisMultiplexer)
}));
services.AddLocalization();
@@ -143,6 +158,20 @@ namespace MP.Land
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
var connStrFlux = Configuration.GetConnectionString("MP.Flux")
?? throw new InvalidOperationException("ConnString 'MP.Flux' mancante.");
services.AddDbContextFactory<MoonPro_FluxContext>(options =>
options.UseSqlServer(connStrFlux)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
var connStrStats = Configuration.GetConnectionString("MP.Stats")
?? throw new InvalidOperationException("ConnString 'MP.Stats' mancante.");
services.AddDbContextFactory<MoonPro_STATSContext>(options =>
options.UseSqlServer(connStrStats)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
//init servizi specifici LAND
//services.AddAuthLandDataLayer();
services.AddLandDataLayer();