diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index b3d96ba1..d50f5fb4 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net8.0 enable - 8.16.2606.311 + 8.16.2606.407 enable MP_TAB3 diff --git a/MP-TAB3/Program.cs b/MP-TAB3/Program.cs index 178df0d6..f00f0736 100644 --- a/MP-TAB3/Program.cs +++ b/MP-TAB3/Program.cs @@ -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(redisMultiplexer); +// ✅ FusionCache +builder.Services.AddFusionCache() + .WithDistributedCache(sp => sp.GetRequiredService()) + .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(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(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(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); @@ -43,13 +75,10 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddScoped(); -#if false -builder.Services.AddBlazoredLocalStorage(); -builder.Services.AddBlazoredSessionStorage(); -#endif // aggiunta helper local/session storage service builder.Services.AddScoped(); -builder.Services.AddScoped(); +builder.Services.AddScoped(); +#endif // gestione email builder.Services.Configure(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("SpecialConf:AppUrl") ?? (configuration.GetValue("OptConf:AppUrl") ?? ""); +var pathBase = configuration.GetValue("SpecialConf:AppUrl") ?? (configuration.GetValue("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("ServerConf:BasePathDisegni") ?? configuration.GetValue("OptConf:BasePathDisegni")?? ""; +string BasePathDisegni = configuration.GetValue("ServerConf:BasePathDisegni") ?? configuration.GetValue("OptConf:BasePathDisegni") ?? ""; if (!string.IsNullOrEmpty(BasePathDisegni)) { // verifico esista folder disegni diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 40cd97d7..8907be06 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 8.16.2606.311

+

Versione: 8.16.2606.407


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index aa5451d0..0d17f6bd 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.311 +8.16.2606.407 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index f12d84a9..ab911600 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.311 + 8.16.2606.407 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP-TAB3/appsettings.json b/MP-TAB3/appsettings.json index 6ef14f69..47c80c14 100644 --- a/MP-TAB3/appsettings.json +++ b/MP-TAB3/appsettings.json @@ -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;", diff --git a/MP.Data/DataServiceCollectionExtensions.cs b/MP.Data/DataServiceCollectionExtensions.cs index 826ce9f2..ddc1ef7c 100644 --- a/MP.Data/DataServiceCollectionExtensions.cs +++ b/MP.Data/DataServiceCollectionExtensions.cs @@ -148,6 +148,23 @@ namespace MP.Data /// public static IServiceCollection AddTabDataLayer(this IServiceCollection services) { + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + + services.TryAddSingleton(); + + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddSingleton(); + services.TryAddScoped(); + // aggiunta helper local/session storage service + services.TryAddScoped(); + services.TryAddScoped(); return services; } diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index d12186f5..ef7907fa 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 8.16.2606.311 + 8.16.2606.408 diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index aff20529..878755a2 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 8.16.2606.311

    +

    Versione: 8.16.2606.408


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index aa5451d0..988a0006 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.311 +8.16.2606.408 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 5e64eb24..e69c68e1 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.311 + 8.16.2606.408 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj index 29e1b914..5f54a793 100644 --- a/MP.IOC/MP.IOC.csproj +++ b/MP.IOC/MP.IOC.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 8.16.2606.318 + 8.16.2606.407 diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 0f1cd517..60835c6f 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

      Versione: 8.16.2606.318

      +

      Versione: 8.16.2606.407


      Note di rilascio:
      • diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt index ea702b6d..0d17f6bd 100644 --- a/MP.IOC/Resources/VersNum.txt +++ b/MP.IOC/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.318 +8.16.2606.407 diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml index 1ddeedf0..e5620788 100644 --- a/MP.IOC/Resources/manifest.xml +++ b/MP.IOC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.318 + 8.16.2606.407 https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html false diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj index 1d8ab17b..f0bd44bd 100644 --- a/MP.MON/MP.MON.csproj +++ b/MP.MON/MP.MON.csproj @@ -6,7 +6,7 @@ enable MP.MON $(AssemblyName.Replace(' ', '_')) - 8.16.2606.312 + 8.16.2606.318 diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html index 81ed3f86..0e773c8e 100644 --- a/MP.MON/Resources/ChangeLog.html +++ b/MP.MON/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

        Versione: 8.16.2606.312

        +

        Versione: 8.16.2606.318


        Note di rilascio:
        • diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt index 1b236191..ea702b6d 100644 --- a/MP.MON/Resources/VersNum.txt +++ b/MP.MON/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.312 +8.16.2606.318 diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml index ef808f77..f12feb05 100644 --- a/MP.MON/Resources/manifest.xml +++ b/MP.MON/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.312 + 8.16.2606.318 https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index 82cdeb00..add2792d 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net8.0 MP.Prog - 8.16.2606.0310 + 8.16.2606.0408 True diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index 03a88103..ad30d9e0 100644 --- a/MP.Prog/Resources/ChangeLog.html +++ b/MP.Prog/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

          Versione: 8.16.2606.0310

          +

          Versione: 8.16.2606.0408


          Note di rilascio:
            diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index 6970c00b..47fe7fc3 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.0310 +8.16.2606.0408 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index 70ae7425..93ee4351 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.0310 + 8.16.2606.0408 https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/Startup.cs b/MP.Prog/Startup.cs index 8f941fab..0e2707af 100644 --- a/MP.Prog/Startup.cs +++ b/MP.Prog/Startup.cs @@ -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(options => - //{ - // options.ConnectionString = elmaConn; - //}); - #if false services.AddStackExchangeRedisCache(options => { diff --git a/MP.SPEC/Components/Reparti/ListOperatori.razor.cs b/MP.SPEC/Components/Reparti/ListOperatori.razor.cs index 03bf5bca..73f18c0b 100644 --- a/MP.SPEC/Components/Reparti/ListOperatori.razor.cs +++ b/MP.SPEC/Components/Reparti/ListOperatori.razor.cs @@ -155,7 +155,7 @@ namespace MP.SPEC.Components.Reparti } private async Task DoReset() { - selRec = null; + selRec = null; await EC_RecSel.InvokeAsync(null); } diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index f6768500..8ddbce9d 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -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; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 0c0a71b8..57e69437 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 8.16.2606.317 + 8.16.2606.407 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index 04f79f14..a90fc99b 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -177,6 +177,13 @@ builder.Services.AddDbContextFactory(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(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(); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 56193a1d..8907be06 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

            Versione: 8.16.2606.317

            +

            Versione: 8.16.2606.407


            Note di rilascio:
            • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 8c2eaf7f..0d17f6bd 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.317 +8.16.2606.407 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index e67b9b17..3ce53f92 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.317 + 8.16.2606.407 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/appsettings.json b/MP.SPEC/appsettings.json index 594aca27..6bda77be 100644 --- a/MP.SPEC/appsettings.json +++ b/MP.SPEC/appsettings.json @@ -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" diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index 54e4803b..247fa567 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -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(); diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 73e0c184..6a9935f9 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net8.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 8.16.2606.0311 + 8.16.2606.0408 true en diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index 7ee0c500..793e14ba 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

              Versione: 8.16.2606.0311

              +

              Versione: 8.16.2606.0408


              Note di rilascio:
                diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index 4143bf31..47fe7fc3 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.0311 +8.16.2606.0408 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index 7a375362..0a7e3eaa 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.0311 + 8.16.2606.0408 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Startup.cs b/MP.Stats/Startup.cs index 3511f254..17c36165 100644 --- a/MP.Stats/Startup.cs +++ b/MP.Stats/Startup.cs @@ -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()) + .WithSerializer(new FusionCacheNewtonsoftJsonSerializer()) + .WithBackplane(new RedisBackplane(new RedisBackplaneOptions + { + ConnectionMultiplexerFactory = () => Task.FromResult(redisMultiplexer) + })); // Add services x accesso dati services.AddSingleton(redisMultiplexer); + // aggiungo il costruttore x i vari DbContextFactory + var connStr = Configuration.GetConnectionString("MP.Stats") + ?? throw new InvalidOperationException("ConnString 'MP.Stats' mancante."); + services.AddDbContextFactory(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(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(Configuration); + services.AddStatsDataLayer(); + //services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); services.AddScoped(); } diff --git a/MP.Stats/appsettings.json b/MP.Stats/appsettings.json index 0dc6bccb..56b81552 100644 --- a/MP.Stats/appsettings.json +++ b/MP.Stats/appsettings.json @@ -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" },