diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj
index b79bd3a4..b3d96ba1 100644
--- a/MP-TAB3/MP-TAB3.csproj
+++ b/MP-TAB3/MP-TAB3.csproj
@@ -3,7 +3,7 @@
net8.0
enable
- 8.16.2606.119
+ 8.16.2606.311
enable
MP_TAB3
diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html
index 7e42922e..40cd97d7 100644
--- a/MP-TAB3/Resources/ChangeLog.html
+++ b/MP-TAB3/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.119
+ Versione: 8.16.2606.311
Note di rilascio:
-
diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt
index 28d1df86..aa5451d0 100644
--- a/MP-TAB3/Resources/VersNum.txt
+++ b/MP-TAB3/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.311
diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml
index d464ba46..f12d84a9 100644
--- a/MP-TAB3/Resources/manifest.xml
+++ b/MP-TAB3/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.311
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.AppAuth/Controllers/AppAuthController.cs b/MP.AppAuth/Controllers/AppAuthController.cs
index bd6047d5..91407d3e 100644
--- a/MP.AppAuth/Controllers/AppAuthController.cs
+++ b/MP.AppAuth/Controllers/AppAuthController.cs
@@ -12,16 +12,23 @@ namespace MP.AppAuth.Controllers
{
public class AppAuthController
{
+ #region Private Fields
+
+ private readonly IConfiguration _configuration;
+
+ private static Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion
+
#region Public Constructors
public AppAuthController(IConfiguration configuration)
{
_configuration = configuration;
-
Log.Info("Avviata classe AppAuthController");
}
- #endregion Public Constructors
+ #endregion
#region Public Methods
@@ -189,8 +196,6 @@ namespace MP.AppAuth.Controllers
return dbResult;
}
-
-
///
/// Elenco Record x gestione Update
///
@@ -225,12 +230,5 @@ namespace MP.AppAuth.Controllers
}
#endregion Public Methods
-
- #region Private Fields
-
- private static IConfiguration _configuration;
- private static Logger Log = LogManager.GetCurrentClassLogger();
-
- #endregion Private Fields
}
-}
\ No newline at end of file
+}
diff --git a/MP.AppAuth/Controllers/AppUserController.cs b/MP.AppAuth/Controllers/AppUserController.cs
index dde09586..f906fbb5 100644
--- a/MP.AppAuth/Controllers/AppUserController.cs
+++ b/MP.AppAuth/Controllers/AppUserController.cs
@@ -11,6 +11,16 @@ namespace MP.AppAuth.Controllers
{
public class AppUserController : IDisposable
{
+ #region Private Fields
+
+ private readonly IConfiguration _configuration;
+
+ private static Logger Log = LogManager.GetCurrentClassLogger();
+
+ private bool _disposed = false;
+
+ #endregion
+
#region Public Constructors
public AppUserController(IConfiguration configuration)
@@ -19,7 +29,7 @@ namespace MP.AppAuth.Controllers
Log.Info("Avviata classe AppUserController");
}
- #endregion Public Constructors
+ #endregion
#region Public Methods
@@ -42,18 +52,28 @@ namespace MP.AppAuth.Controllers
return dbResult;
}
- public void Dispose()
- {
- GC.Collect();
- }
-
#endregion Public Methods
- #region Private Fields
+ #region Protected Methods
- private static IConfiguration _configuration = null!;
- private static Logger Log = LogManager.GetCurrentClassLogger();
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposed)
+ {
+ if (disposing)
+ {
+ // Free managed resources here
+ }
+ _disposed = true;
+ }
+ }
- #endregion Private Fields
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ #endregion
}
-}
\ No newline at end of file
+}
diff --git a/MP.AppAuth/Controllers/MPController .cs b/MP.AppAuth/Controllers/MPController .cs
index b3dee069..739b5150 100644
--- a/MP.AppAuth/Controllers/MPController .cs
+++ b/MP.AppAuth/Controllers/MPController .cs
@@ -10,19 +10,15 @@ namespace MP.AppAuth.Controllers
{
public class MPController : IDisposable
{
- #region Public Fields
-
- public static MPController dbController;
-
- #endregion Public Fields
-
#region Private Fields
- private static IConfiguration _configuration;
+ private readonly IConfiguration _configuration;
private static Logger Log = LogManager.GetCurrentClassLogger();
- #endregion Private Fields
+ private bool _disposed = false;
+
+ #endregion
#region Public Constructors
@@ -32,7 +28,7 @@ namespace MP.AppAuth.Controllers
Log.Info("Avviata classe MpController");
}
- #endregion Public Constructors
+ #endregion
#region Public Methods
@@ -271,15 +267,6 @@ namespace MP.AppAuth.Controllers
return fatto;
}
- public void Dispose()
- {
- if (dbController != null)
- {
- // Clear database controller
- dbController.Dispose();
- }
- }
-
///
/// Elenco Record x ListValues
///
@@ -380,5 +367,27 @@ namespace MP.AppAuth.Controllers
}
#endregion Public Methods
+
+ #region Protected Methods
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposed)
+ {
+ if (disposing)
+ {
+ // Free managed resources here
+ }
+ _disposed = true;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ #endregion
}
-}
\ No newline at end of file
+}
diff --git a/MP.AppAuth/DataServiceCollectionExtensions.cs b/MP.AppAuth/DataServiceCollectionExtensions.cs
new file mode 100644
index 00000000..56841d9a
--- /dev/null
+++ b/MP.AppAuth/DataServiceCollectionExtensions.cs
@@ -0,0 +1,23 @@
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MP.AppAuth
+{
+ public static class DataServiceCollectionExtensions
+ {
+ ///
+ /// Aggiunta repository/servizi specifici per IOC
+ ///
+ ///
+ ///
+ public static IServiceCollection AddAuthLandDataLayer(this IServiceCollection services)
+ {
+
+ return services;
+ }
+ }
+}
diff --git a/MP.AppAuth/Services/AppAuthService.cs b/MP.AppAuth/Services/AppAuthService.cs
index 7ab866af..f4ec89f4 100644
--- a/MP.AppAuth/Services/AppAuthService.cs
+++ b/MP.AppAuth/Services/AppAuthService.cs
@@ -20,10 +20,6 @@ namespace MP.AppAuth.Services
// diritti (cablato)
public const string RoleSuperAdmin = "MoonPro_SuperAdmin";
- public static AppAuthController dbController;
- public static MPController MpDbController;
- public static AppUserController userController;
-
#endregion Public Fields
#region Private Fields
@@ -37,15 +33,15 @@ namespace MP.AppAuth.Services
private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
- private static IConfiguration _configuration;
+ private readonly IConfiguration _configuration;
- private static ILogger _logger;
+ private readonly ILogger _logger;
- private static JsonSerializerSettings? JSSettings;
+ private readonly JsonSerializerSettings? JSSettings;
private static Logger Log = LogManager.GetCurrentClassLogger();
- private static string Modulo = "";
+ private string Modulo = "";
///
/// Durata cache lunga IN SECONDI
@@ -60,23 +56,27 @@ namespace MP.AppAuth.Services
///
/// Oggetto per connessione a REDIS
///
- private IConnectionMultiplexer redisConn;
+ private readonly IConnectionMultiplexer redisConn;
//ISubscriber sub = redis.GetSubscriber();
///
/// Oggetto DB redis da impiegare x chiamate R/W
///
- private StackExchange.Redis.IDatabase redisDb = null!;
+ private readonly StackExchange.Redis.IDatabase redisDb;
- private Random rnd = new Random();
+ private readonly Random rnd = new Random();
private Dictionary Vocabolario = new Dictionary();
+ private readonly AppAuthController _appAuthController;
+ private readonly MPController _mpController;
+ private readonly AppUserController _appUserController;
+
#endregion Private Fields
#region Public Constructors
- public AppAuthService(IConfiguration configuration, ILogger logger, IConnectionMultiplexer redisConnMult)
+ public AppAuthService(IConfiguration configuration, ILogger logger, IConnectionMultiplexer redisConnMult, AppAuthController appAuthController, MPController mpController, AppUserController appUserController)
{
_logger = logger;
_configuration = configuration;
@@ -103,9 +103,9 @@ namespace MP.AppAuth.Services
}
else
{
- dbController = new AppAuthController(configuration);
- MpDbController = new MPController(configuration);
- userController = new AppUserController(configuration);
+ _appAuthController = appAuthController;
+ _mpController = mpController;
+ _appUserController = appUserController;
_logger.LogInformation("DbController OK");
}
}
@@ -114,7 +114,7 @@ namespace MP.AppAuth.Services
#region Private Properties
- private string CodApp { get; set; } = "";
+ private string CodApp { get; }
///
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
@@ -153,7 +153,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagCauSca();
+ dbResult = _mpController.AnagCauSca();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagCauSca: {ts.TotalMilliseconds} ms");
@@ -169,7 +169,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagClassiTempo();
+ dbResult = _mpController.AnagClassiTempo();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagClassiTempo: {ts.TotalMilliseconds} ms");
@@ -185,7 +185,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagEventi();
+ dbResult = _mpController.AnagEventi();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagEventi: {ts.TotalMilliseconds} ms");
@@ -201,7 +201,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = dbController.AnagGruppiGetAll();
+ dbResult = _appAuthController.AnagGruppiGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagGruppiAll: {ts.TotalMilliseconds} ms");
@@ -213,7 +213,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = dbController.AnagGruppiFilt(codTipo);
+ dbResult = _appAuthController.AnagGruppiFilt(codTipo);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagGruppiFilt: {ts.TotalMilliseconds} ms");
@@ -229,7 +229,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagIngressi();
+ dbResult = _mpController.AnagIngressi();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagIngressi: {ts.TotalMilliseconds} ms");
@@ -241,7 +241,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.AnagKeyValuesUpsert(currRec);
+ answ = _mpController.AnagKeyValuesUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"AnagKeyValAdd | Aggiunto rec | NomeVar: {currRec.NomeVar} | durata: {ts.TotalMilliseconds} ms");
@@ -253,7 +253,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.AnagKeyValuesDelete(NomeVar);
+ answ = _mpController.AnagKeyValuesDelete(NomeVar);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"AnagKeyValDelete | Effettuata cancellazione | NomeVar: {NomeVar} | durata: {ts.TotalMilliseconds} ms");
@@ -265,7 +265,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagKeyValuesGetAll();
+ dbResult = _mpController.AnagKeyValuesGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagKeyValList: {ts.TotalMilliseconds} ms");
@@ -277,7 +277,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.AnagKeyValuesUpsert(currRec);
+ answ = _mpController.AnagKeyValuesUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"AnagKeyValUpd | Effettuata modifica | NomeVar: {currRec.NomeVar} | durata: {ts.TotalMilliseconds} ms");
@@ -293,7 +293,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagMicroStati();
+ dbResult = _mpController.AnagMicroStati();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagMicroStati: {ts.TotalMilliseconds} ms");
@@ -305,7 +305,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- var rawData = dbController
+ var rawData = _appAuthController
.AnagOpByGruppoGetFilt(codGruppo, searchVal);
dbResult = rawData
.GroupBy(user => user.MatrOpr)
@@ -322,7 +322,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = dbController.AnagOpGetAll(searchVal);
+ dbResult = _appAuthController.AnagOpGetAll(searchVal);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagOperList: {ts.TotalMilliseconds} ms");
@@ -338,7 +338,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.AnagStati();
+ dbResult = _mpController.AnagStati();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagStati: {ts.TotalMilliseconds} ms");
@@ -350,7 +350,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.ConfigUpsert(currRec);
+ answ = _mpController.ConfigUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"ConfigAdd | Aggiunto rec | Chiave: {currRec.Chiave} | durata: {ts.TotalMilliseconds} ms");
@@ -362,7 +362,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.ConfigDelete(Chiave);
+ answ = _mpController.ConfigDelete(Chiave);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"ConfigDelete | Effettuata cancellazione | Chiave: {Chiave} | durata: {ts.TotalMilliseconds} ms");
@@ -374,7 +374,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.ConfigGetAll();
+ dbResult = _mpController.ConfigGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ConfigList: {ts.TotalMilliseconds} ms");
@@ -386,7 +386,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.ConfigUpsert(currRec);
+ answ = _mpController.ConfigUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"ConfigUpd | Effettuata modifica | Chiave: {currRec.Chiave} | durata: {ts.TotalMilliseconds} ms");
@@ -415,7 +415,7 @@ namespace MP.AppAuth.Services
else
{
// recupero diritti utente
- dbResult = userController.DirittiUtente(UserName, Modulo);
+ dbResult = _appUserController.DirittiUtente(UserName, Modulo);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
@@ -430,11 +430,8 @@ namespace MP.AppAuth.Services
public void Dispose()
{
- // Clear database controller
- if (MpDbController != null)
- {
- MpDbController.Dispose();
- }
+ // Clear database controllers
+ _mpController?.Dispose();
}
public async Task FlushRedisCache()
@@ -455,7 +452,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.ListValues();
+ dbResult = _mpController.ListValues();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ListValues: {ts.TotalMilliseconds} ms");
@@ -484,7 +481,7 @@ namespace MP.AppAuth.Services
else
{
// recupero diritti utente
- dbResult = MpDbController.MacchineGetAll();
+ dbResult = _mpController.MacchineGetAll();
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
redisDb.StringSet(currKey, rawData, UltraLongCache);
}
@@ -526,7 +523,7 @@ namespace MP.AppAuth.Services
else
{
// recupero diritti utente
- var userRightList = userController.DirittiUtente(UserName, Modulo);
+ var userRightList = _appUserController.DirittiUtente(UserName, Modulo);
// proietto come funzioni...
var ListFunc = userRightList.Select(x => x.Funzione).ToList();
// trasformo i permessi utente
@@ -534,7 +531,7 @@ namespace MP.AppAuth.Services
{
ListFunc = new List();
}
- dbResult = dbController.PermessiGetByFunc(ListFunc);
+ dbResult = _appAuthController.PermessiGetByFunc(ListFunc);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
@@ -565,7 +562,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = dbController.UpdManGetAll();
+ dbResult = _appAuthController.UpdManGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per UpdManList: {ts.TotalMilliseconds} ms");
@@ -577,7 +574,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.VocabolarioUpsert(currRec);
+ answ = _mpController.VocabolarioUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"VocabolarioAdd | Aggiunto rec | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
@@ -589,7 +586,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.VocabolarioDelete(currRec);
+ answ = _mpController.VocabolarioDelete(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"VocabolarioDelete | Effettuata cancellazione | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
@@ -601,7 +598,7 @@ namespace MP.AppAuth.Services
List dbResult = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- dbResult = MpDbController.VocabolarioGetAll();
+ dbResult = _mpController.VocabolarioGetAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per VocabolarioList: {ts.TotalMilliseconds} ms");
@@ -613,7 +610,7 @@ namespace MP.AppAuth.Services
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
- answ = MpDbController.VocabolarioUpsert(currRec);
+ answ = _mpController.VocabolarioUpsert(currRec);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"VocabolarioUpd | Effettuata modifica | lingua: {currRec.Lingua} | lemma: {currRec.Lemma} | durata: {ts.TotalMilliseconds} ms");
@@ -641,7 +638,7 @@ namespace MP.AppAuth.Services
}
else
{
- Vocabolario = dbController
+ Vocabolario = _appAuthController
.VocabolarioGetAll()
.ToDictionary(x => $"{x.Lingua}#{x.Lemma}", x => x.Traduzione);
rawData = JsonConvert.SerializeObject(Vocabolario);
@@ -665,10 +662,10 @@ namespace MP.AppAuth.Services
{
bool answ = false;
var masterEndpoint = redisConn.GetEndPoints()
- .Where(ep => redisConn.GetServer(ep).IsConnected && !redisConn.GetServer(ep).IsReplica)
- .FirstOrDefault();
+ .Where(ep => redisConn.GetServer(ep).IsConnected && !redisConn.GetServer(ep).IsReplica)
+ .FirstOrDefault();
- // sepattern è "*" elimino intero DB...
+ // se pattern è "*" elimino intero DB...
if (masterEndpoint != null && (pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
{
redisConn.GetServer(masterEndpoint).FlushDatabase(database: redisDb.Database);
@@ -699,4 +696,4 @@ namespace MP.AppAuth.Services
#endregion Private Methods
}
-}
\ No newline at end of file
+}
diff --git a/MP.Data/Controllers/MpLandController.cs b/MP.Data/Controllers/MpLandController.cs
index 9a77ad18..a87c3492 100644
--- a/MP.Data/Controllers/MpLandController.cs
+++ b/MP.Data/Controllers/MpLandController.cs
@@ -20,7 +20,7 @@ namespace MP.Data.Controllers
{
_configuration = configuration;
string connStr = _configuration.GetConnectionString("MP.Land");
- if(string.IsNullOrEmpty(connStr))
+ if (string.IsNullOrEmpty(connStr))
{
connStr = _configuration.GetConnectionString("MP.Data");
}
@@ -143,7 +143,8 @@ namespace MP.Data.Controllers
public void Dispose()
{
- _configuration = null;
+ Dispose(true);
+ GC.SuppressFinalize(this);
}
///
@@ -262,11 +263,28 @@ namespace MP.Data.Controllers
#endregion Public Methods
+ #region Protected Methods
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!_disposed)
+ {
+ if (disposing)
+ {
+ // Free managed resources here
+ }
+ _disposed = true;
+ }
+ }
+
+ #endregion Protected Methods
+
#region Private Fields
- private static IConfiguration _configuration;
private static Logger Log = LogManager.GetCurrentClassLogger();
- private DbContextOptions options;
+ private readonly IConfiguration _configuration;
+ private readonly DbContextOptions options;
+ private bool _disposed = false;
#endregion Private Fields
}
diff --git a/MP.Data/Controllers/MpVocController.cs b/MP.Data/Controllers/MpVocController.cs
index 713dc387..e78b7a8b 100644
--- a/MP.Data/Controllers/MpVocController.cs
+++ b/MP.Data/Controllers/MpVocController.cs
@@ -1,14 +1,10 @@
-using DnsClient.Protocol;
-using Microsoft.Data.SqlClient;
-using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Data.DbModels;
using NLog;
using System;
using System.Collections.Generic;
-using System.Drawing.Drawing2D;
using System.Linq;
-using static MP.Core.Objects.Enums;
namespace MP.Data.Controllers
{
@@ -19,6 +15,10 @@ namespace MP.Data.Controllers
public MpVocController(IConfiguration configuration)
{
_configuration = configuration;
+ string connStr = _configuration.GetConnectionString("MP.Voc");
+ options = new DbContextOptionsBuilder()
+ .UseSqlServer(connStr)
+ .Options;
Log.Info("Avviata classe MpVocController");
}
@@ -26,6 +26,7 @@ namespace MP.Data.Controllers
#region Public Methods
+ private DbContextOptions options;
///
/// Elenco da tabella Config
///
@@ -33,15 +34,12 @@ namespace MP.Data.Controllers
public List ConfigGetAll()
{
List dbResult = new List();
- using (var dbCtx = new MoonPro_VocContext(_configuration))
- {
- dbResult = dbCtx
- .DbSetConfig
- .AsNoTracking()
- .OrderBy(x => x.Chiave)
- .ToList();
- }
- return dbResult;
+ using var dbCtx = new MoonPro_VocContext(options);
+ return dbCtx
+ .DbSetConfig
+ .AsNoTracking()
+ .OrderBy(x => x.Chiave)
+ .ToList();
}
public void Dispose()
@@ -55,15 +53,12 @@ namespace MP.Data.Controllers
public List LingueGetAll()
{
List dbResult = new List();
- using (var dbCtx = new MoonPro_VocContext(_configuration))
- {
- dbResult = dbCtx
- .DbSetLilngue
- .AsNoTracking()
- .OrderBy(x => x.Lingua)
- .ToList();
- }
- return dbResult;
+ using var dbCtx = new MoonPro_VocContext(options);
+ return dbCtx
+ .DbSetLilngue
+ .AsNoTracking()
+ .OrderBy(x => x.Lingua)
+ .ToList();
}
///
@@ -73,15 +68,12 @@ namespace MP.Data.Controllers
public List VocabolarioGetAll()
{
List dbResult = new List();
- using (var dbCtx = new MoonPro_VocContext(_configuration))
- {
- dbResult = dbCtx
- .DbSetVocabolario
- .AsNoTracking()
- .OrderBy(x => x.Lemma)
- .ToList();
- }
- return dbResult;
+ using var dbCtx = new MoonPro_VocContext(options);
+ return dbCtx
+ .DbSetVocabolario
+ .AsNoTracking()
+ .OrderBy(x => x.Lemma)
+ .ToList();
}
#endregion Public Methods
diff --git a/MP.Data/DataServiceCollectionExtensions.cs b/MP.Data/DataServiceCollectionExtensions.cs
index b2f236c8..6b0b34ed 100644
--- a/MP.Data/DataServiceCollectionExtensions.cs
+++ b/MP.Data/DataServiceCollectionExtensions.cs
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
+using MP.AppAuth.Controllers;
using MP.AppAuth.Services;
using MP.Data.Controllers;
using MP.Data.Repository.Anag;
@@ -49,6 +50,33 @@ namespace MP.Data
return services;
}
///
+ /// Aggiunta repository/servizi specifici per LAND
+ ///
+ ///
+ ///
+ public static IServiceCollection AddLandDataLayer(this IServiceCollection services)
+ {
+
+ services.TryAddSingleton();
+ services.TryAddSingleton();
+ services.TryAddSingleton();
+ services.TryAddSingleton();
+
+ return services;
+ }
+ ///
+ /// Aggiunta repository/servizi specifici per MON
+ ///
+ ///
+ ///
+ public static IServiceCollection AddMonDataLayer(this IServiceCollection services)
+ {
+
+ services.TryAddSingleton();
+ services.TryAddSingleton();
+ return services;
+ }
+ ///
/// Aggiunta repository/servizi specifici per SPEC
///
///
@@ -56,10 +84,8 @@ namespace MP.Data
public static IServiceCollection AddSpecDataLayer(this IServiceCollection services)
{
// ---------- Start Repository ----------
- // Singleton
- services.TryAddSingleton();
+ services.TryAddScoped();
- // Scoped
services.TryAddScoped();
services.TryAddScoped();
services.TryAddScoped();
@@ -67,35 +93,26 @@ namespace MP.Data
services.TryAddScoped();
services.TryAddScoped();
services.TryAddScoped();
-
-
// ---------- End Repository ----------
// ---------- Start Servizi ----------
-
- // Singleton
-
//services.TryAddSingleton();
-
- // Scoped
-
// ---------- End Servizi ----------
// ---------- Start Altro ----------
- // Singleton
- services.TryAddSingleton();
+ services.TryAddScoped();
+ services.TryAddScoped();
+ services.TryAddScoped();
+ services.TryAddScoped();
services.TryAddScoped();
services.TryAddScoped();
services.TryAddSingleton();
services.TryAddSingleton();
- services.TryAddSingleton();
-
- // Scoped
+ services.TryAddScoped();
services.AddScoped();
services.AddScoped();
-
// ---------- End Altro ----------
return services;
diff --git a/MP.Data/DbModels/AlarmLogModel.cs b/MP.Data/DbModels/AlarmLogModel.cs
index d7578850..59baf27f 100644
--- a/MP.Data/DbModels/AlarmLogModel.cs
+++ b/MP.Data/DbModels/AlarmLogModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -16,6 +17,7 @@ namespace MP.Data.DbModels
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int AlarmLogId { get; set; } = 0;
public DateTime DtRif { get; set; } = DateTime.Now;
+ [Precision(18, 6)]
public decimal Duration { get; set; } = 0;
public string MachineId { get; set; } = "";
public string MemAddress { get; set; } = "";
diff --git a/MP.Data/DbModels/DbSizeModel.cs b/MP.Data/DbModels/DbSizeModel.cs
index 1704ae77..4606349f 100644
--- a/MP.Data/DbModels/DbSizeModel.cs
+++ b/MP.Data/DbModels/DbSizeModel.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel.DataAnnotations;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
namespace MP.Data.DbModels
{
@@ -6,6 +7,7 @@ namespace MP.Data.DbModels
{
[Key]
public string DbName { get; set; } = "";
+ [Precision(18, 6)]
public decimal DbSizeMb { get; set; } = 0;
public int NumTables { get; set; } = 0;
public string BigTable { get; set; } = "";
diff --git a/MP.Data/DbModels/InsManualiModel.cs b/MP.Data/DbModels/InsManualiModel.cs
index a692763d..a1e8e3c7 100644
--- a/MP.Data/DbModels/InsManualiModel.cs
+++ b/MP.Data/DbModels/InsManualiModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -35,11 +36,13 @@ namespace MP.Data.DbModels
///
/// Tempo Ciclo std
///
+ [Precision(18, 6)]
public decimal TCiclo { get; set; } = 0;
///
/// Minuti prodotti (da TC e pz prod
///
+ [Precision(18, 6)]
public decimal MinProd { get; set; } = 0;
///
@@ -50,7 +53,7 @@ namespace MP.Data.DbModels
[NotMapped]
public bool IsWork
{
- get => IdxTipoEv == 1;
+ get => IdxTipoEv == 1;
}
diff --git a/MP.Data/DbModels/ODLExpModel.cs b/MP.Data/DbModels/ODLExpModel.cs
index 6c6d5b45..1517d9d8 100644
--- a/MP.Data/DbModels/ODLExpModel.cs
+++ b/MP.Data/DbModels/ODLExpModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -19,7 +20,9 @@ namespace MP.Data.DbModels
public string CodArticolo { get; set; } = "";
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; }
+ [Precision(18, 6)]
public decimal Tcassegnato { get; set; }
+ [Precision(18, 6)]
public decimal TCRichAttr { get; set; }
public DateTime? DataInizio { get; set; }
public DateTime? DataFine { get; set; }
diff --git a/MP.Data/DbModels/ODLModel.cs b/MP.Data/DbModels/ODLModel.cs
index caaf0845..0bfff032 100644
--- a/MP.Data/DbModels/ODLModel.cs
+++ b/MP.Data/DbModels/ODLModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -21,6 +22,7 @@ namespace MP.Data.DbModels
[MaxLength(50)]
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; }
+ [Precision(18, 6)]
public decimal Tcassegnato { get; set; }
public DateTime? DataInizio { get; set; }
public DateTime? DataFine { get; set; }
diff --git a/MP.Data/DbModels/PODLExpModel.cs b/MP.Data/DbModels/PODLExpModel.cs
index e4590159..7b8fecd0 100644
--- a/MP.Data/DbModels/PODLExpModel.cs
+++ b/MP.Data/DbModels/PODLExpModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -28,6 +29,7 @@ namespace MP.Data.DbModels
[MaxLength(50)]
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; } = 1;
+ [Precision(18, 6)]
public decimal Tcassegnato { get; set; } = 1;
public DateTime? DueDate { get; set; }
public int Priorita { get; set; } = 1;
diff --git a/MP.Data/DbModels/PODLModel.cs b/MP.Data/DbModels/PODLModel.cs
index 818c5235..66d79107 100644
--- a/MP.Data/DbModels/PODLModel.cs
+++ b/MP.Data/DbModels/PODLModel.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -29,6 +30,7 @@ namespace MP.Data.DbModels
[MaxLength(50)]
public string IdxMacchina { get; set; }
public int NumPezzi { get; set; } = 1;
+ [Precision(18, 6)]
public decimal Tcassegnato { get; set; } = 1;
public DateTime? DueDate { get; set; }
public int Priorita { get; set; } = 1;
diff --git a/MP.Data/DbModels/TksScoreModel.cs b/MP.Data/DbModels/TksScoreModel.cs
index d90efb2d..12fdfe78 100644
--- a/MP.Data/DbModels/TksScoreModel.cs
+++ b/MP.Data/DbModels/TksScoreModel.cs
@@ -1,4 +1,5 @@
-using System.ComponentModel.DataAnnotations;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
//
// This is here so CodeMaid doesn't reorganize this document
@@ -24,6 +25,7 @@ namespace MP.Data.DbModels
///
/// Score Cicli Associati
///
+ [Precision(18, 6)]
public decimal ChildScore { get; set; } = 0;
///
/// Score complessivo
diff --git a/MP.Data/MoonPro_VocContext.cs b/MP.Data/MoonPro_VocContext.cs
index ca357a74..441d5e1b 100644
--- a/MP.Data/MoonPro_VocContext.cs
+++ b/MP.Data/MoonPro_VocContext.cs
@@ -1,7 +1,4 @@
-using System;
-using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata;
-using Microsoft.Extensions.Configuration;
+using Microsoft.EntityFrameworkCore;
using MP.Data.DbModels;
using NLog;
@@ -17,16 +14,16 @@ namespace MP.Data
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
- private IConfiguration _configuration;
+ //private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
- public MoonPro_VocContext(IConfiguration configuration)
- {
- _configuration = configuration;
- }
+ //public MoonPro_VocContext(IConfiguration configuration)
+ //{
+ // _configuration = configuration;
+ //}
public MoonPro_VocContext(DbContextOptions options) : base(options)
{
@@ -52,11 +49,16 @@ namespace MP.Data
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
+ //if (!optionsBuilder.IsConfigured)
+ //{
+ // string connString = _configuration.GetConnectionString("MP.Voc");
+
+ // optionsBuilder.UseSqlServer(connString);
+ //}
if (!optionsBuilder.IsConfigured)
{
- string connString = _configuration.GetConnectionString("MP.Voc");
-
- optionsBuilder.UseSqlServer(connString);
+ // fallback si spera non necessario
+ optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
}
}
diff --git a/MP.Data/Services/BaseServ.cs b/MP.Data/Services/BaseServ.cs
index 51355686..770df68e 100644
--- a/MP.Data/Services/BaseServ.cs
+++ b/MP.Data/Services/BaseServ.cs
@@ -161,7 +161,7 @@ namespace MP.Data.Services
///
protected static readonly ActivitySource ActivitySource = new ActivitySource("MP.IOC");
- protected static IConfiguration _configuration = null!;
+ protected IConfiguration _configuration = null!;
///
/// Abilitazione operazioni tracing generiche
diff --git a/MP.Data/Services/LandDataService.cs b/MP.Data/Services/LandDataService.cs
index 453c45ff..a94c0634 100644
--- a/MP.Data/Services/LandDataService.cs
+++ b/MP.Data/Services/LandDataService.cs
@@ -40,12 +40,6 @@ namespace MP.Data.Services
#endregion Public Constructors
- #region Public Properties
-
- public static MpLandController dbController { get; set; } = null!;
-
- #endregion Public Properties
-
#region Public Methods
///
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index 13723817..d12186f5 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 8.16.2606.119
+ 8.16.2606.311
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index 805e9ef3..aff20529 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
-
Versione: 8.16.2606.119
+ Versione: 8.16.2606.311
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index 28d1df86..aa5451d0 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.311
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index 635c7a5f..5e64eb24 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.311
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 56eeddca..88739b41 100644
--- a/MP.IOC/MP.IOC.csproj
+++ b/MP.IOC/MP.IOC.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 8.16.2606.119
+ 8.16.2606.311
diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html
index 03c738b7..55fd6939 100644
--- a/MP.IOC/Resources/ChangeLog.html
+++ b/MP.IOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-IOC
-
Versione: 8.16.2606.119
+ Versione: 8.16.2606.311
Note di rilascio:
-
diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt
index 28d1df86..aa5451d0 100644
--- a/MP.IOC/Resources/VersNum.txt
+++ b/MP.IOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.311
diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml
index d3e771b6..92f155e7 100644
--- a/MP.IOC/Resources/manifest.xml
+++ b/MP.IOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.311
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.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 2d7b8b5e..508b0702 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2606.0119
+ 8.16.2606.0312
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index 17946008..a19361ad 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
-
Versione: 8.16.2606.0119
+ Versione: 8.16.2606.0312
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 8bc36859..b505b6b3 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0119
+8.16.2606.0312
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 5a0155ac..c16761d9 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0119
+ 8.16.2606.0312
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html
false
diff --git a/MP.Land/Startup.cs b/MP.Land/Startup.cs
index 77b74a07..b8b345a7 100644
--- a/MP.Land/Startup.cs
+++ b/MP.Land/Startup.cs
@@ -2,25 +2,21 @@ using Blazored.LocalStorage;
using Blazored.SessionStorage;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
-using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Localization;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using MP.AppAuth.Services;
-using MP.Data.Services;
+using MP.Data;
using MP.Land.Data;
using MP.TaskMan.Services;
using StackExchange.Redis;
using System;
-using System.Collections.Generic;
-using System.Configuration;
using System.Globalization;
-using System.Linq;
-using System.Threading.Tasks;
namespace MP.Land
{
@@ -138,12 +134,24 @@ namespace MP.Land
services.AddServerSideBlazor();
services.AddSingleton(Configuration);
+
+ // aggiungo il costruttore x i vari DbContextFactory
+ var connStr = Configuration.GetConnectionString("MP.Land")
+ ?? throw new InvalidOperationException("ConnString 'MP.Land' mancante.");
+ services.AddDbContextFactory(options =>
+ options.UseSqlServer(connStr)
+ .EnableSensitiveDataLogging(false) // true solo in Sviluppo
+ .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
+
+ //init servizi specifici LAND
+ //services.AddAuthLandDataLayer();
+ services.AddLandDataLayer();
services.AddSingleton();
- services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
+ //services.AddSingleton();
+ //services.AddSingleton();
+ //services.AddSingleton();
services.AddScoped();
services.AddScoped();
diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj
index 2a883698..1d8ab17b 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.119
+ 8.16.2606.312
diff --git a/MP.MON/Program.cs b/MP.MON/Program.cs
index ad200407..20e4cd80 100644
--- a/MP.MON/Program.cs
+++ b/MP.MON/Program.cs
@@ -1,3 +1,6 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Diagnostics;
+using MP.Data;
using MP.Data.Services;
using MP.MON.Components;
using NLog;
@@ -26,10 +29,21 @@ string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"))
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
+// aggiungo il costruttore x i vari DbContextFactory
+var connStr = builder.Configuration.GetConnectionString("MP.Mon")
+ ?? throw new InvalidOperationException("ConnString 'MP.Mon' mancante.");
+builder.Services.AddDbContextFactory(options =>
+ options.UseSqlServer(connStr)
+ .EnableSensitiveDataLogging(false) // true solo in Sviluppo
+ .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
+
// Add services to the container.
logger.Info("Setup Services");
+
builder.Services.AddSingleton(redisMultiplexer);
-builder.Services.AddSingleton();
+// Init centralizzato Repository/Servizi da MP.Data Services
+builder.Services.AddMonDataLayer();
+
var app = builder.Build();
diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html
index 7e42922e..81ed3f86 100644
--- a/MP.MON/Resources/ChangeLog.html
+++ b/MP.MON/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2606.119
+ Versione: 8.16.2606.312
Note di rilascio:
-
diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt
index 28d1df86..1b236191 100644
--- a/MP.MON/Resources/VersNum.txt
+++ b/MP.MON/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.312
diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml
index ebd7fc6e..ef808f77 100644
--- a/MP.MON/Resources/manifest.xml
+++ b/MP.MON/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.312
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.MON/appsettings.json b/MP.MON/appsettings.json
index c9f20d06..5b692c2d 100644
--- a/MP.MON/appsettings.json
+++ b/MP.MON/appsettings.json
@@ -2,7 +2,9 @@
"Logging": {
"LogLevel": {
"Default": "Information",
- "Microsoft.AspNetCore": "Warning"
+ "Microsoft.AspNetCore": "Warning",
+ "Microsoft.EntityFrameworkCore": "Warning",
+ "Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
},
"NLog": {
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index e1e72fa3..82cdeb00 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Prog
- 8.16.2606.0119
+ 8.16.2606.0310
True
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index c430a648..03a88103 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.0119
+ Versione: 8.16.2606.0310
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index 8bc36859..6970c00b 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0119
+8.16.2606.0310
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index b57cd977..70ae7425 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0119
+ 8.16.2606.0310
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.RIOC/MP.RIOC.csproj b/MP.RIOC/MP.RIOC.csproj
index a159eed4..7bc99308 100644
--- a/MP.RIOC/MP.RIOC.csproj
+++ b/MP.RIOC/MP.RIOC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.RIOC
- 8.16.2606.119
+ 8.16.2606.311
diff --git a/MP.RIOC/Resources/ChangeLog.html b/MP.RIOC/Resources/ChangeLog.html
index c1503a5c..0271b927 100644
--- a/MP.RIOC/Resources/ChangeLog.html
+++ b/MP.RIOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-RIOC
-
Versione: 8.16.2606.119
+ Versione: 8.16.2606.311
Note di rilascio:
-
diff --git a/MP.RIOC/Resources/VersNum.txt b/MP.RIOC/Resources/VersNum.txt
index 28d1df86..aa5451d0 100644
--- a/MP.RIOC/Resources/VersNum.txt
+++ b/MP.RIOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.311
diff --git a/MP.RIOC/Resources/manifest.xml b/MP.RIOC/Resources/manifest.xml
index 8ddc1c1b..9fb2ac1c 100644
--- a/MP.RIOC/Resources/manifest.xml
+++ b/MP.RIOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.311
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.RIOC/appsettings.json b/MP.RIOC/appsettings.json
index 590b8fb4..2c648666 100644
--- a/MP.RIOC/appsettings.json
+++ b/MP.RIOC/appsettings.json
@@ -3,7 +3,9 @@
"LogLevel": {
"Default": "Information",
"Yarp": "Debug",
- "Microsoft.AspNetCore": "Warning"
+ "Microsoft.AspNetCore": "Warning",
+ "Microsoft.EntityFrameworkCore": "Warning",
+ "Microsoft.EntityFrameworkCore.Database.Command": "Warning"
}
},
"AllowedHosts": "*",
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 3e0b2962..951addc4 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -31,10 +31,27 @@ namespace MP.SPEC.Data
private readonly IFluxLogRepository _fluxLogRepository;
private readonly IProductionRepository _productionRepository;
- public MpDataService(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;
+ redisConn = connMPlex;
+ redisDb = redisConn.GetDatabase();
+
+#if false
+ // setup compoenti REDIS
+ redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis") ?? "localhost:6379");
+ redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin") ?? "localhost:6379");
+ redisDb = redisConn.GetDatabase();
+#endif
+ // leggo cache lungo/cordo periodo
+ int.TryParse(_configuration.GetValue("ServerConf:redisShortTimeCache"), out redisShortTimeCache);
+ int.TryParse(_configuration.GetValue("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
+
+ // setup MsgPipe
+ BroadastMsgPipe = new MessagePipe(redisConn, Constants.BROADCAST_M_PIPE);
+ Log.Info("MpDataService | Redis OK");
+
_cache = cache;
_anagRepository = anagRepository;
_systemRepository = systemRepository;
@@ -524,7 +541,7 @@ namespace MP.SPEC.Data
{
// Clear database controller
mongoController.Dispose();
- redisConn.Dispose();
+ //redisConn.Dispose();
}
///
@@ -2009,7 +2026,7 @@ namespace MP.SPEC.Data
///
/// Oggetto per connessione a REDIS
///
- private ConnectionMultiplexer redisConn = null!;
+ private IConnectionMultiplexer redisConn = null!;
///
/// Oggetto per connessione a REDIS modalità admin (ex flux dati)
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index 2952fe88..85941120 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 8.16.2606.119
+ 8.16.2606.311
1800a78a-6ff1-40f9-b490-87fb8bfc1394
en
diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs
index 36036cdd..64fd379e 100644
--- a/MP.SPEC/Program.cs
+++ b/MP.SPEC/Program.cs
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.StaticFiles;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Caching.Distributed;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.FileProviders;
using MP.Data;
using MP.SPEC.Components;
@@ -159,19 +160,23 @@ builder.Services.AddFusionCache()
// Metodi principali x accesso dati
var connStr = builder.Configuration.GetConnectionString("MP.Data")
?? throw new InvalidOperationException("ConnString 'MP.Data' mancante.");
-// aggiungo il costruttore x i DbContextFactory
+// 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)));
+builder.Services.AddDbContextFactory(options =>
+ options.UseSqlServer(connStr)
+ .EnableSensitiveDataLogging(false) // true solo in Sviluppo
+ .ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
// MP.Data Services Utils - Statistiche DB
builder.Services.AddSpecDataLayer();
-// altri servizi
-builder.Services.AddSingleton();
-builder.Services.AddSingleton();
-builder.Services.AddScoped();
+// servizi del progetto SPEC
+builder.Services.TryAddScoped();
+builder.Services.TryAddSingleton();
+builder.Services.TryAddScoped();
#if false
builder.Services.AddSingleton();
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index 7e42922e..40cd97d7 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
-
Versione: 8.16.2606.119
+ Versione: 8.16.2606.311
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index 28d1df86..aa5451d0 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.119
+8.16.2606.311
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index 5cb1e4dd..c283f196 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.119
+ 8.16.2606.311
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 683abe14..594aca27 100644
--- a/MP.SPEC/appsettings.json
+++ b/MP.SPEC/appsettings.json
@@ -3,6 +3,8 @@
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
+ "Microsoft.EntityFrameworkCore": "Warning",
+ "Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"ZiggyCreatures.Caching.Fusion": "Warning"
}
},
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj
index 1ff2dc91..73e0c184 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.0119
+ 8.16.2606.0311
true
en
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html
index 16ce0ff0..7ee0c500 100644
--- a/MP.Stats/Resources/ChangeLog.html
+++ b/MP.Stats/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo statistiche MAPO
-
Versione: 8.16.2606.0119
+ Versione: 8.16.2606.0311
Note di rilascio:
diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt
index 8bc36859..4143bf31 100644
--- a/MP.Stats/Resources/VersNum.txt
+++ b/MP.Stats/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2606.0119
+8.16.2606.0311
diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml
index d9cde985..7a375362 100644
--- a/MP.Stats/Resources/manifest.xml
+++ b/MP.Stats/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2606.0119
+ 8.16.2606.0311
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