Completata review di tutti i progetti coi nuovi repository!

This commit is contained in:
Samuele Locatelli
2026-06-04 08:12:05 +02:00
parent 217836099c
commit 8c6bf075fb
39 changed files with 148 additions and 66 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>8.16.2606.311</Version>
<Version>8.16.2606.407</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+41 -12
View File
@@ -2,16 +2,18 @@
using Blazored.LocalStorage;
using Blazored.SessionStorage;
#endif
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.FileProviders;
using MP.Data;
using MP.Data.Services;
using NLog;
using NLog.Web;
using StackExchange.Redis;
using static Org.BouncyCastle.Math.EC.ECCurve;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
var builder = WebApplication.CreateBuilder(args);
@@ -27,15 +29,45 @@ var cString = configuration.GetConnectionString("Redis");
string connStringRedis = cString ?? "localhost:6379, DefaultDatabase=5, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false";
//string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
IConnectionMultiplexer redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
// Add services x accesso dati
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
// ✅ FusionCache
builder.Services.AddFusionCache()
.WithDistributedCache(sp => sp.GetRequiredService<IDistributedCache>())
.WithSerializer(new FusionCacheNewtonsoftJsonSerializer())
.WithBackplane(new RedisBackplane(new RedisBackplaneOptions
{
ConnectionMultiplexerFactory = () => Task.FromResult(redisMultiplexer)
}));
// Metodi principali x accesso dati
var connStr = builder.Configuration.GetConnectionString("MP.Data")
?? throw new InvalidOperationException("ConnString 'MP.Data' mancante.");
// aggiungo il costruttore x i vari DbContextFactory
builder.Services.AddDbContextFactory<MoonProContext>(options =>
options.UseSqlServer(connStr)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
var connStrFL = builder.Configuration.GetConnectionString("MP.Flux")
?? throw new InvalidOperationException("ConnString 'MP.Flux' mancante.");
builder.Services.AddDbContextFactory<MoonPro_FluxContext>(options =>
options.UseSqlServer(connStrFL)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
// Init centralizzato Repository/Servizi da MP.Data Services
builder.Services.AddTabDataLayer();
#if false
builder.Services.AddSingleton<TabDataFeeder>();
builder.Services.AddSingleton<StatusData>();
builder.Services.AddSingleton<ListSelectDataSrv>();
@@ -43,13 +75,10 @@ builder.Services.AddSingleton<OrderDataSrv>();
builder.Services.AddSingleton<SharedMemService>();
builder.Services.AddSingleton<TabDataService>();
builder.Services.AddScoped<MessageService>();
#if false
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddBlazoredSessionStorage();
#endif
// aggiunta helper local/session storage service
builder.Services.AddScoped<ISessionStorageService, SessionStorageService>();
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
#endif
// gestione email
builder.Services.Configure<MailKitMailSettings>(builder.Configuration.GetSection(nameof(MailKitMailSettings)));
@@ -62,7 +91,7 @@ logger.Info("Aggiunti services");
var app = builder.Build();
// aggiunt base URL x routing corretto
var pathBase= configuration.GetValue<string>("SpecialConf:AppUrl") ?? (configuration.GetValue<string>("OptConf:AppUrl") ?? "");
var pathBase = configuration.GetValue<string>("SpecialConf:AppUrl") ?? (configuration.GetValue<string>("OptConf:AppUrl") ?? "");
app.UsePathBase(pathBase);
// Configure the HTTP request pipeline.
@@ -78,7 +107,7 @@ app.UseHttpsRedirection();
app.UseStaticFiles();
// gestione static files: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-8.0
string BasePathDisegni = configuration.GetValue<string>("ServerConf:BasePathDisegni") ?? configuration.GetValue<string>("OptConf:BasePathDisegni")?? "";
string BasePathDisegni = configuration.GetValue<string>("ServerConf:BasePathDisegni") ?? configuration.GetValue<string>("OptConf:BasePathDisegni") ?? "";
if (!string.IsNullOrEmpty(BasePathDisegni))
{
// verifico esista folder disegni
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.311</h4>
<h4>Versione: 8.16.2606.407</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.311
8.16.2606.407
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.311</version>
<version>8.16.2606.407</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -7
View File
@@ -8,16 +8,10 @@
"AllowedHosts": "*",
"CodApp": "MP.TAB",
"ConnectionStrings": {
//"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=6,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
//"MP.All": "Server=SQL2022PROD;Database=Donati_LAV_MoonPro_prod; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
//"MP.Mon": "Server=SQL2022PROD;Database=Donati_LAV_MoonPro_prod; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
//"MP.IS": "Server=SQL2022PROD;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
//"MP.Tab": "Server=SQL2022PROD;Database=Donati_LAV_MoonPro_prod; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
//"MP.Mag": "Server=SQL2022PROD;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;"
"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
"MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
"MP.Flux": "Server=SQL2016DEV;Database=MoonPro_FluxData; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
"MP.Mon": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
"MP.IS": "Server=SQL2016DEV;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
"MP.Tab": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;",
@@ -148,6 +148,23 @@ namespace MP.Data
/// <returns></returns>
public static IServiceCollection AddTabDataLayer(this IServiceCollection services)
{
services.TryAddSingleton<IAnagRepository, AnagRepository>();
services.TryAddSingleton<IProductionRepository, ProductionRepository>();
services.TryAddSingleton<IMpMonRepository, MpMonRepository>();
services.TryAddSingleton<ISystemRepository, SystemRepository>();
services.TryAddSingleton<MpIocController>();
services.TryAddSingleton<TabDataFeeder>();
services.TryAddSingleton<StatusData>();
services.TryAddSingleton<ListSelectDataSrv>();
services.TryAddSingleton<OrderDataSrv>();
services.TryAddSingleton<SharedMemService>();
services.TryAddSingleton<TabDataService>();
services.TryAddScoped<MessageService>();
// aggiunta helper local/session storage service
services.TryAddScoped<ISessionStorageService, SessionStorageService>();
services.TryAddScoped<ILocalStorageService, LocalStorageService>();
return services;
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>8.16.2606.311</Version>
<Version>8.16.2606.408</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 8.16.2606.311</h4>
<h4>Versione: 8.16.2606.408</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.311
8.16.2606.408
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.311</version>
<version>8.16.2606.408</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>8.16.2606.318</Version>
<Version>8.16.2606.407</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 8.16.2606.318</h4>
<h4>Versione: 8.16.2606.407</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.318
8.16.2606.407
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.318</version>
<version>8.16.2606.407</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>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.MON</RootNamespace>
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
<Version>8.16.2606.312</Version>
<Version>8.16.2606.318</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.312</h4>
<h4>Versione: 8.16.2606.318</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.312
8.16.2606.318
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.312</version>
<version>8.16.2606.318</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>8.16.2606.0310</Version>
<Version>8.16.2606.0408</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 8.16.2606.0310</h4>
<h4>Versione: 8.16.2606.0408</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.0310
8.16.2606.0408
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.0310</version>
<version>8.16.2606.0408</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
-11
View File
@@ -88,9 +88,6 @@ namespace MP.Prog
});
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT");
//// Registrazione Elmah:
//// https://github.com/ElmahCore/ElmahCore
//app.UseElmah();
// fix forwarders
app.UseForwardedHeaders(new ForwardedHeadersOptions
@@ -152,14 +149,6 @@ namespace MP.Prog
o.SlidingExpiration = true;
});
//// Elmah
//services.AddElmah();
//string elmaConn = "Data Source=SQL2016DEV;Initial Catalog=Elmah;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=SHERPA.BBM;";
//services.AddElmah<SqlErrorLog>(options =>
//{
// options.ConnectionString = elmaConn;
//});
#if false
services.AddStackExchangeRedisCache(options =>
{
@@ -155,7 +155,7 @@ namespace MP.SPEC.Components.Reparti
}
private async Task DoReset()
{
selRec = null;
selRec = null;
await EC_RecSel.InvokeAsync(null);
}
+9 -1
View File
@@ -31,7 +31,15 @@ namespace MP.SPEC.Data
private readonly IFluxLogRepository _fluxLogRepository;
private readonly IProductionRepository _productionRepository;
public MpDataService(IConnectionMultiplexer connMPlex, IConfiguration configuration, IFusionCache cache, IAnagRepository anagRepository, ISystemRepository systemRepository, IDossierRepository dossierRepository, IFluxLogRepository fluxLogRepository, IProductionRepository productionRepository)
public MpDataService(
IConnectionMultiplexer connMPlex,
IConfiguration configuration,
IFusionCache cache,
IAnagRepository anagRepository,
ISystemRepository systemRepository,
IDossierRepository dossierRepository,
IFluxLogRepository fluxLogRepository,
IProductionRepository productionRepository)
{
// salvataggio oggetti
_configuration = configuration;
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>8.16.2606.317</Version>
<Version>8.16.2606.407</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+7
View File
@@ -177,6 +177,13 @@ builder.Services.AddDbContextFactory<MoonPro_FluxContext>(options =>
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
var connStrSta = builder.Configuration.GetConnectionString("MP.Stats")
?? throw new InvalidOperationException("ConnString 'MP.Stats' mancante.");
builder.Services.AddDbContextFactory<MoonPro_STATSContext>(options =>
options.UseSqlServer(connStrSta)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
// Init centralizzato Repository/Servizi da MP.Data Services
builder.Services.AddSpecDataLayer();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.317</h4>
<h4>Versione: 8.16.2606.407</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.317
8.16.2606.407
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.317</version>
<version>8.16.2606.407</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -63,6 +63,7 @@
"MP.Land": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Land.Auth": "Server=SQL2016DEV;Database=MoonPro_Anagrafica; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Sched": "Server=SQL2016DEV;Database=MoonPro_ES3; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.SPEC;",
"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"RedisAdmin": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true",
"mdbConnString": "mongodb://W2019-MONGODB:27017"
+6 -1
View File
@@ -11,6 +11,7 @@ using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using ZiggyCreatures.Caching.Fusion;
namespace MP.Stats.Data
{
@@ -24,7 +25,11 @@ namespace MP.Stats.Data
#region Public Constructors
public MpStatsService(IConfiguration configuration, IConnectionMultiplexer redConn) : base(configuration, redConn)
public MpStatsService(
IConfiguration configuration,
IConnectionMultiplexer redConn,
IFusionCache cache
) : base(configuration, cache, redConn)
{
Stopwatch sw = Stopwatch.StartNew();
sw.Start();
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>8.16.2606.0311</Version>
<Version>8.16.2606.0408</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 8.16.2606.0311</h4>
<h4>Versione: 8.16.2606.0408</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.0311
8.16.2606.0408
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.0311</version>
<version>8.16.2606.0408</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+37 -3
View File
@@ -1,10 +1,14 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
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;
using Microsoft.OpenApi.Models;
using MP.Data;
using MP.Data.Services;
using MP.Stats.Data;
using MP.TaskMan.Services;
@@ -13,6 +17,10 @@ using System;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
namespace MP.Stats
{
@@ -133,11 +141,35 @@ namespace MP.Stats
var cString = Configuration.GetConnectionString("Redis");
string connStringRedis = cString ?? "localhost:6379, DefaultDatabase=5, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false";
// 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)
}));
// Add services x accesso dati
services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
// aggiungo il costruttore x i vari DbContextFactory
var connStr = Configuration.GetConnectionString("MP.Stats")
?? throw new InvalidOperationException("ConnString 'MP.Stats' mancante.");
services.AddDbContextFactory<MoonPro_STATSContext>(options =>
options.UseSqlServer(connStr)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
var connStrVoc = Configuration.GetConnectionString("MP.Voc")
?? throw new InvalidOperationException("ConnString 'MP.Voc' mancante.");
services.AddDbContextFactory<MoonPro_VocContext>(options =>
options.UseSqlServer(connStrVoc)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
services.AddLocalization();
@@ -145,9 +177,11 @@ namespace MP.Stats
services.AddServerSideBlazor();
services.AddSingleton<IConfiguration>(Configuration);
services.AddStatsDataLayer();
//services.AddSingleton<TranslateSrv>();
services.AddSingleton<MpStatsService>();
services.AddSingleton<TaskService>();
services.AddSingleton<TranslateSrv>();
services.AddScoped<MP.Stats.Data.MessageService>();
}
-2
View File
@@ -53,8 +53,6 @@
"ConnectionStrings": {
"DefaultConnection": "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;MultipleActiveResultSets=true",
"MP.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;",
//"DefaultConnection": "Server=SQL2016DEV;Database=Jetco_MoonPro_STATS_Prod;Trusted_Connection=True;MultipleActiveResultSets=true",
//"MP.Stats": "Server=SQL2022PROD;Database=Jetco_MoonPro_STATS_Prod;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;",
"MP.Voc": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;",
"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
},