diff --git a/MP.Data/DataServiceCollectionExtensions.cs b/MP.Data/DataServiceCollectionExtensions.cs index 2adc1d06..8ed9107a 100644 --- a/MP.Data/DataServiceCollectionExtensions.cs +++ b/MP.Data/DataServiceCollectionExtensions.cs @@ -34,6 +34,7 @@ namespace MP.Data { // Repository Singleton services.TryAddSingleton(); + services.TryAddSingleton(); // Repository Scoped services.TryAddScoped(); diff --git a/MP.IOC/Data/MpDataService.cs b/MP.IOC/Data/MpDataService.cs index fed66bf3..87ed22a2 100644 --- a/MP.IOC/Data/MpDataService.cs +++ b/MP.IOC/Data/MpDataService.cs @@ -7,6 +7,7 @@ using MP.Data.Controllers; using MP.Data.DbModels; using MP.Data.DbModels.Anag; using MP.Data.MgModels; +using MP.Data.Repository.Production; using MP.Data.Services.IOC; using MP.Data.Services.Mtc; using Newtonsoft.Json; @@ -22,17 +23,22 @@ namespace MP.IOC.Data public class MpDataService { #region Public Constructors + private readonly IProductionRepository _productionRepository; public MpDataService( IConfiguration configuration, ILogger logger, IServiceScopeFactory scopeFactory, + IProductionRepository productionRepository, + MpIocController mpIocCtr, IMtcSetupService mtcServ) { _logger = logger; _logger.LogInformation("Starting MpDataService INIT"); _configuration = configuration; _scopeFactory = scopeFactory; + _productionRepository = productionRepository; + IocDbController = mpIocCtr; // setup compoenti REDIS redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); @@ -58,8 +64,10 @@ namespace MP.IOC.Data } else { - SpecDbController = new MpSpecController(configuration); +#if false + SpecDbController = new MpSpecController(configuration); IocDbController = new MpIocController(configuration); +#endif Log.Info("DbControllers INIT OK"); } @@ -83,9 +91,11 @@ namespace MP.IOC.Data #region Public Properties - public static MpIocController IocDbController { get; set; } = null!; public static MpMongoController mongoController { get; set; } = null!; - public static MpSpecController SpecDbController { get; set; } = null!; + public static MpIocController IocDbController { get; set; } = null!; +#if false + public static MpSpecController SpecDbController { get; set; } = null!; +#endif public MessagePipe BroadastMsgPipe { get; set; } = null!; /// @@ -1209,7 +1219,7 @@ namespace MP.IOC.Data } else { - result = await SpecDbController.MacchineGetFiltAsync(codGruppo); + result = await _productionRepository.MacchineGetFiltAsync(codGruppo); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); @@ -1622,7 +1632,7 @@ namespace MP.IOC.Data } else { - result = await SpecDbController.PODL_getByKeyAsync(idxPODL); + result = await _productionRepository.PODL_getByKeyAsync(idxPODL); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj index 88739b41..29e1b914 100644 --- a/MP.IOC/MP.IOC.csproj +++ b/MP.IOC/MP.IOC.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 8.16.2606.311 + 8.16.2606.318 diff --git a/MP.IOC/Program.cs b/MP.IOC/Program.cs index 8a3df56f..8945acd4 100644 --- a/MP.IOC/Program.cs +++ b/MP.IOC/Program.cs @@ -42,18 +42,26 @@ logger.Info("RedisScript Provider configured"); // Metodi principali x accesso dati var connStr = builder.Configuration.GetConnectionString("MP.Data") ?? throw new InvalidOperationException("ConnString 'MP.Data' mancante."); - builder.Services.AddMemoryCache(); - builder.Services.AddDbContextFactory(options => options.UseSqlServer(connStr) .EnableSensitiveDataLogging(false) // true solo in Sviluppo .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning))); // MP.Data DbContext for Stats repositories -string utilsConnString = builder.Configuration.GetConnectionString("MP.Utils") ?? "Server=localhost;Database=MoonPro_Utils; integrated security=True; MultipleActiveResultSets=True; App=MP.IOC;"; +string connStrUtils = builder.Configuration.GetConnectionString("MP.Utils") + ?? throw new InvalidOperationException("ConnString 'MP.Utils' mancante."); +//?? "Server=localhost;Database=MoonPro_Utils; integrated security=True; MultipleActiveResultSets=True; App=MP.IOC;"; builder.Services.AddDbContextFactory(options => - options.UseSqlServer(utilsConnString)); + options.UseSqlServer(connStrUtils).EnableSensitiveDataLogging(false) + .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))); // MP.Data Services Utils - Statistiche DB builder.Services.AddIocDataLayer(); diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 55fd6939..0f1cd517 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

Versione: 8.16.2606.311

+

Versione: 8.16.2606.318


Note di rilascio:
  • diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt index aa5451d0..ea702b6d 100644 --- a/MP.IOC/Resources/VersNum.txt +++ b/MP.IOC/Resources/VersNum.txt @@ -1 +1 @@ -8.16.2606.311 +8.16.2606.318 diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml index 92f155e7..1ddeedf0 100644 --- a/MP.IOC/Resources/manifest.xml +++ b/MP.IOC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 8.16.2606.311 + 8.16.2606.318 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