diff --git a/Directory.Packages.props b/Directory.Packages.props
index 7890a5ee..de11e9b3 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -43,6 +43,7 @@
+
diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
index c283840e..65fb7f53 100644
--- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
+++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
@@ -5469,37 +5469,6 @@ namespace EgwCoreLib.Lux.Data.Controllers
#endregion Internal Methods
-#if false
- ///
- /// Elenco item Child da ID Parent (per sostituzione)
- ///
- /// ID parent (valido quindi >0)
- ///
- internal List ItemGetChild(int ItemIdParent)
- {
- List dbResult = new List();
- if (ItemIdParent > 0)
- {
- //using (DataLayerContext dbCtx = new DataLayerContext(configuration))
- using (DataLayerContext dbCtx = new DataLayerContext())
- {
- try
- {
- dbResult = dbCtx
- .DbSetItem
- .Where(x => x.ItemID == ItemIdParent || x.ItemIDParent == ItemIdParent)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ItemGetChild{Environment.NewLine}{exc}");
- }
- }
- }
- return dbResult;
- }
-#endif
-
#region Private Fields
private static IConfiguration _configuration;
diff --git a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj
index fed9128f..de103521 100644
--- a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj
+++ b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj
@@ -48,6 +48,7 @@
+
diff --git a/EgwCoreLib.Lux.Data/Repository/BaseRepository.cs b/EgwCoreLib.Lux.Data/Repository/BaseRepository.cs
new file mode 100644
index 00000000..bc46dccd
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/BaseRepository.cs
@@ -0,0 +1,14 @@
+namespace EgwCoreLib.Lux.Data.Repository
+{
+ public abstract class BaseRepository : IBaseRepository
+ {
+ protected readonly DataLayerContext _db;
+ protected BaseRepository(DataLayerContext db) => _db = db;
+
+ ///
+ /// Salvataggio dati asincrono
+ ///
+ ///
+ public async Task SaveChangesAsync() => await _db.SaveChangesAsync() > 0;
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Repository/IBaseRepository.cs b/EgwCoreLib.Lux.Data/Repository/IBaseRepository.cs
new file mode 100644
index 00000000..4094a92d
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/IBaseRepository.cs
@@ -0,0 +1,7 @@
+namespace EgwCoreLib.Lux.Data.Repository
+{
+ public interface IBaseRepository
+ {
+ Task SaveChangesAsync();
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Repository/Utils/GenClassRepository.cs b/EgwCoreLib.Lux.Data/Repository/Utils/GenClassRepository.cs
new file mode 100644
index 00000000..ccf78dc1
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/Utils/GenClassRepository.cs
@@ -0,0 +1,20 @@
+using EgwCoreLib.Lux.Data.DbModel.Utils;
+using Microsoft.EntityFrameworkCore;
+
+namespace EgwCoreLib.Lux.Data.Repository.Utils
+{
+ public class GenClassRepository : BaseRepository, IGenClassRepository
+ {
+ public GenClassRepository(DataLayerContext db) : base(db) { }
+
+ public async Task> GetAllWithNavAsync() =>
+ await _db.DbSetGenClass.Include(x => x.GenValNav).ToListAsync();
+
+ public async Task GetByCodeAsync(string code) =>
+ await _db.DbSetGenClass.FirstOrDefaultAsync(x => x.ClassCod == code);
+
+ public void Add(GenClassModel entity) => _db.DbSetGenClass.Add(entity);
+
+ public void Delete(GenClassModel entity) => _db.DbSetGenClass.Remove(entity);
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Repository/Utils/IGenClassRepository.cs b/EgwCoreLib.Lux.Data/Repository/Utils/IGenClassRepository.cs
new file mode 100644
index 00000000..d415a3c6
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/Utils/IGenClassRepository.cs
@@ -0,0 +1,12 @@
+using EgwCoreLib.Lux.Data.DbModel.Utils;
+
+namespace EgwCoreLib.Lux.Data.Repository.Utils
+{
+ public interface IGenClassRepository : IBaseRepository
+ {
+ Task> GetAllWithNavAsync();
+ Task GetByCodeAsync(string code);
+ void Add(GenClassModel entity);
+ void Delete(GenClassModel entity);
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/BaseServ.cs b/EgwCoreLib.Lux.Data/Services/BaseServ.cs
index 3f89266a..0aaa0ef9 100644
--- a/EgwCoreLib.Lux.Data/Services/BaseServ.cs
+++ b/EgwCoreLib.Lux.Data/Services/BaseServ.cs
@@ -29,11 +29,11 @@ namespace EgwCoreLib.Lux.Data.Services
public BaseServ(IConfiguration Configuration, IConnectionMultiplexer RedisConn)
{
_config = Configuration;
- redisConn = RedisConn;
- redisDb = redisConn.GetDatabase();
+ _redisConn = RedisConn;
+ _redisDb = _redisConn.GetDatabase();
// setup tracing
// Verifica conf trace...
- traceEnabled = _config.GetValue("Otel:EnableTracing", false);
+ _traceEnabled = _config.GetValue("Otel:EnableTracing", false);
// receving channel name setup
chBom = _config.GetValue("ServerConf:ChannelBom") ?? "lux:bom";
chHwList = _config.GetValue("ServerConf:ChannelHwList") ?? "lux:hw:list";
@@ -64,16 +64,16 @@ namespace EgwCoreLib.Lux.Data.Services
};
// Configurazione pipe dei messaggi
- PipeBom = new MessagePipe(redisConn, chBom);
- PipeHwList = new MessagePipe(redisConn, chHwList);
- PipeHwOpt = new MessagePipe(redisConn, chHwOpt);
- PipePng = new MessagePipe(redisConn, chPng);
- PipeProd = new MessagePipe(redisConn, chProd);
- PipeProfElement = new MessagePipe(redisConn, chProfElem);
- PipeProfList = new MessagePipe(redisConn, chProfList);
- PipeShape = new MessagePipe(redisConn, chShape);
- PipeSvg = new MessagePipe(redisConn, chSvg);
- PipeUpdate = new MessagePipe(redisConn, chUpdate);
+ PipeBom = new MessagePipe(_redisConn, chBom);
+ PipeHwList = new MessagePipe(_redisConn, chHwList);
+ PipeHwOpt = new MessagePipe(_redisConn, chHwOpt);
+ PipePng = new MessagePipe(_redisConn, chPng);
+ PipeProd = new MessagePipe(_redisConn, chProd);
+ PipeProfElement = new MessagePipe(_redisConn, chProfElem);
+ PipeProfList = new MessagePipe(_redisConn, chProfList);
+ PipeShape = new MessagePipe(_redisConn, chShape);
+ PipeSvg = new MessagePipe(_redisConn, chSvg);
+ PipeUpdate = new MessagePipe(_redisConn, chUpdate);
}
#endregion Public Constructors
@@ -151,7 +151,7 @@ namespace EgwCoreLib.Lux.Data.Services
/// Oggetto di configurazione statico per accedere alle impostazioni dell'applicazione (es. stringhe di connessione).
/// Condiviso tra tutte le istanze di BaseServ.
///
- protected static IConfiguration _config = null!;
+ protected readonly IConfiguration _config = null!;
///
/// Oggetto logger utilizzato per registrare eventi e errori a livello di classe.
@@ -168,18 +168,23 @@ namespace EgwCoreLib.Lux.Data.Services
///
/// Oggetto per la connessione a Redis utilizzato per operazioni di lettura/scrittura.
///
- protected IConnectionMultiplexer redisConn = null!;
+ protected readonly IConnectionMultiplexer _redisConn = null!;
+
+ ///
+ /// Path base chiavi REDIS
+ ///
+ protected readonly string redisBaseKey = "Lux:Cache";
///
/// Database Redis utilizzato per le operazioni di lettura/scrittura
/// nb: ottenuto tramite _redisConn.GetDatabase()
///
- protected IDatabase redisDb = null!;
+ protected readonly IDatabase _redisDb = null!;
///
/// Abilitazione operazioni tracing generiche
///
- protected bool traceEnabled = false;
+ protected readonly bool _traceEnabled = false;
#endregion Protected Fields
@@ -239,7 +244,7 @@ namespace EgwCoreLib.Lux.Data.Services
///
protected void LogTrace(string traceMsg, NLog.LogLevel? reqLevel = null, [CallerMemberName] string? methodName = null)
{
- if (!traceEnabled)
+ if (!_traceEnabled)
return;
reqLevel ??= NLog.LogLevel.Debug;
@@ -250,6 +255,91 @@ namespace EgwCoreLib.Lux.Data.Services
#endregion Protected Methods
+ ///
+ /// Invalida una o più chiavi/pattern in Redis
+ ///
+ protected async Task ClearCacheAsync(params string[] patterns)
+ {
+ foreach (var pattern in patterns)
+ {
+ // Chiamata al tuo metodo esistente
+ await ExecFlushRedisPatternAsync((RedisValue)pattern);
+ }
+ }
+
+ ///
+ /// Metodo di flush dati cache Redis
+ ///
+ ///
+ ///
+ protected async Task ExecFlushRedisPatternAsync(RedisValue pattern)
+ {
+ // Qui inserisci la tua logica attuale (es. via Lua script o Keys/Scan)
+ // Esempio rapido via server scan:
+ var endpoints = _redisConn.GetEndPoints();
+ foreach (var endpoint in endpoints)
+ {
+ var server = _redisConn.GetServer(endpoint);
+ await foreach (var key in server.KeysAsync(_redisDb.Database, pattern))
+ {
+ await _redisDb.KeyDeleteAsync(key);
+ }
+ }
+ }
+
+ protected async Task GetOrSetCacheAsync(string key, Func> factory, TimeSpan? expiration = null)
+ {
+ using var activity = ActivitySource.StartActivity($"Cache:{key}");
+ string source = "REDIS";
+
+ // 1. Tenta il recupero da Redis
+ var rawData = await _redisDb.StringGetAsync(key);
+
+ if (rawData.HasValue)
+ {
+ activity?.SetTag("data.source", "REDIS");
+ // LogTrace opzionale qui
+ return JsonConvert.DeserializeObject(rawData.ToString())!;
+ }
+
+ // 2. Cache Miss: Esegui la funzione factory (di solito la query al DB)
+ source = "DB";
+ activity?.SetTag("data.source", "DB");
+
+ T result = await factory();
+
+ if (result != null)
+ {
+ // 3. Salva in Redis per la prossima volta
+ var serialized = JsonConvert.SerializeObject(result, JSSettings);
+ await _redisDb.StringSetAsync(key, serialized, expiration ?? LongCache);
+ }
+
+ return result!;
+ }
+
+ protected async Task TraceAsync(string name, Func> body, object? parameters = null)
+ {
+ using var activity = ActivitySource.StartActivity(name);
+ try
+ {
+ if (parameters != null)
+ {
+ activity?.SetTag("params", JsonConvert.SerializeObject(parameters));
+ }
+ var result = await body(activity);
+ activity?.SetStatus(ActivityStatusCode.Ok);
+ return result;
+ }
+ catch (Exception ex)
+ {
+ activity?.SetStatus(ActivityStatusCode.Error, ex.Message);
+ //Log.Error(ex, "Errore in {MethodName}", name);
+ LogTrace($"Errore in {name}", LogLevel.Error, name);
+ throw; // Riesponi l'eccezione per il tracking globale
+ }
+ }
+
#region Private Fields
///
diff --git a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs
index b07e0a8c..388cb503 100644
--- a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs
+++ b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs
@@ -5,11 +5,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
using StackExchange.Redis;
-using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Text;
-using System.Threading.Tasks;
using static Egw.Window.Data.Enums;
namespace EgwCoreLib.Lux.Data.Services
@@ -28,7 +24,7 @@ namespace EgwCoreLib.Lux.Data.Services
_retention = retention;
_archivePeriod = archivePeriod;
// conf DB
- string connStr = BaseServ._config.GetConnectionString("Lux.All") ?? "";
+ string connStr = _config.GetConnectionString("Lux.All") ?? "";
if (string.IsNullOrEmpty(connStr))
{
Log.Error("ConnString empty!");
@@ -311,7 +307,7 @@ namespace EgwCoreLib.Lux.Data.Services
// Recupero processStart e altri dati
var processStartValue = await _db.HashGetAsync(hashKey, "processStart");
- if (processStartValue.IsNull)
+ if (processStartValue.IsNull)
return retVal;
var envir = await _db.HashGetAsync(hashKey, "envir");
var tipo = await _db.HashGetAsync(hashKey, "tipo");
@@ -794,7 +790,7 @@ namespace EgwCoreLib.Lux.Data.Services
/// Restituisce il periodo valido x dati aggregati
///
///
- public async Task StatsAggrRangeAsync()
+ public async Task StatsAggrRangeAsync()
{
var answDto = await dbController.StatsAggrRangeAsync();
return answDto;
diff --git a/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs b/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs
index bf1e194a..ca5b34ee 100644
--- a/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs
+++ b/EgwCoreLib.Lux.Data/Services/ConfigDataService.cs
@@ -38,7 +38,7 @@ namespace EgwCoreLib.Lux.Data.Services
List result = new List();
// leggo obj da redis cache
var currKey = $"{redisBaseKey}:{execEnvironment}:HML:{HwReq}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
// prendo solo i valori validi (Name <> FamilyName)
if (rawData.HasValue)
{
@@ -57,7 +57,7 @@ namespace EgwCoreLib.Lux.Data.Services
List result = new List();
// leggo obj da redis cache
var currKey = $"{redisBaseKey}:{execEnvironment}:PROF:LIST:{ProfReq}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
// prendo solo i valori validi (Name <> FamilyName)
if (rawData.HasValue)
{
@@ -76,7 +76,7 @@ namespace EgwCoreLib.Lux.Data.Services
List result = new List();
// leggo obj da redis cache
var currKey = $"{redisBaseKey}:{execEnvironment}:PROF:THRESH:{ProfReq}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
// prendo solo i valori validi (Name <> FamilyName)
if (rawData.HasValue)
{
@@ -99,7 +99,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
// leggo obj da redis cache
var currKey = $"{redisBaseKey}:{execEnvironment}:PROF:THRESH:{prof}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
// prendo solo i valori validi (Name <> FamilyName)
if (rawData.HasValue)
{
diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
index a604dbd2..84c66e02 100644
--- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
+++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
@@ -27,7 +27,7 @@ namespace EgwCoreLib.Lux.Data.Services
public DataLayerServices(IConfiguration configuration, IConnectionMultiplexer RedisConn) : base(configuration, RedisConn)
{
// conf DB
- string connStr = BaseServ._config.GetConnectionString("Lux.All") ?? "";
+ string connStr = _config.GetConnectionString("Lux.All") ?? "";
if (string.IsNullOrEmpty(connStr))
{
Log.Error("ConnString empty!");
@@ -86,7 +86,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfEnvir";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -97,7 +97,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ConfEnvirParamGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -135,7 +135,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfGlass";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -146,7 +146,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ConfGlassGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -200,7 +200,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfProfile";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -211,7 +211,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ConfProfileGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -265,7 +265,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfWood";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -276,7 +276,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ConfWoodGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -314,7 +314,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:CostDrivers:ALL";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -325,7 +325,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.CostDriverGetAllAsync();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, UltraLongCache);
+ _redisDb.StringSet(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -348,7 +348,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ConfEnvir";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -359,7 +359,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.CountersGetAllAsync(yearRef);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -397,7 +397,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Customers:ALL";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -408,7 +408,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.CustomersGetAll();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, UltraLongCache);
+ _redisDb.StringSet(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -430,7 +430,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Dealers:ALL";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -441,7 +441,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.DealersGetAll();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, LongCache);
+ _redisDb.StringSet(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -540,7 +540,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:GenClass";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -551,7 +551,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.GenClassGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -608,7 +608,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:GenVal:{codClass}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -619,7 +619,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.GenValGetFiltAsync(codClass);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -695,7 +695,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Item:ListAlt:{ItemId}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -706,7 +706,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.ItemGetAlt(ItemId);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- redisDb.StringSet(currKey, rawData, FastCache);
+ _redisDb.StringSet(currKey, rawData, FastCache);
}
if (result == null)
{
@@ -731,7 +731,7 @@ namespace EgwCoreLib.Lux.Data.Services
// cerco in redis...
string groupTok = string.IsNullOrEmpty(CodGroup) ? "ALL" : CodGroup;
string currKey = $"{redisBaseKey}:Item:Filt:{groupTok}:{ItemType}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -742,7 +742,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ItemGetFiltAsync(CodGroup, ItemType);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -766,7 +766,7 @@ namespace EgwCoreLib.Lux.Data.Services
// cerco in redis...
string token = string.IsNullOrEmpty(term) ? "ALL" : term;
string currKey = $"{redisBaseKey}:Item:Search:{token}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -777,7 +777,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ItemGetSearchAsync(term);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -799,7 +799,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ItemGroup:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -810,7 +810,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ItemGroupGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -888,7 +888,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:JobStep:{jobID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -899,7 +899,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.JobStepGetAsync(jobID);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -975,7 +975,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:JobTaskList:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -986,7 +986,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.JobTaskGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1062,7 +1062,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Offers:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1074,7 +1074,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.OfferGetAll();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1098,7 +1098,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Offers:Filt:{inizio:yyMMdd-HHmm}:{fine:yyMMdd-HHmm}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -1109,7 +1109,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.OfferGetFilt(inizio, fine);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1132,7 +1132,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:OfferRows:{OfferID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1144,7 +1144,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OfferRowGetByOffer(OfferID);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1167,7 +1167,7 @@ namespace EgwCoreLib.Lux.Data.Services
OfferRowModel? result = null;
// cerco in redis...
string currKey = $"{redisBaseKey}:OfferRows:ByUID:{OfferRowUID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1179,7 +1179,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OfferRowGetByUID(OfferRowUID);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
activity?.SetTag("data.source", source);
LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1505,7 +1505,7 @@ namespace EgwCoreLib.Lux.Data.Services
OrderModel? result = new OrderModel();
// cerco in redis...
string currKey = $"{redisBaseKey}:Orders:ById:{orderId}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2 && !doForce)
{
result = JsonConvert.DeserializeObject($"{rawData}");
@@ -1516,7 +1516,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.OrderById(orderId);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1581,7 +1581,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Orders:Filt:{inizio:yyMMdd-HHmm}:{fine:yyMMdd-HHmm}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -1592,7 +1592,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.OrderGetFilt(inizio, fine);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1656,7 +1656,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:OrderRows:{OrderID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1668,7 +1668,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OrderRowGetByOffer(OrderID);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1691,7 +1691,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:OrderRows:ByState:{reqState}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1703,7 +1703,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OrderRowGetByState(reqState, dtStart, dtEnd);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, FastCache);
+ await _redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
@@ -1726,7 +1726,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:OrderRows:ByStateMin:{reqState}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1738,7 +1738,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OrderRowGetByStateMin(reqState, dtStart, dtEnd);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, FastCache);
+ await _redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
@@ -1761,7 +1761,7 @@ namespace EgwCoreLib.Lux.Data.Services
OrderRowModel? result = null;
// cerco in redis...
string currKey = $"{redisBaseKey}:OrderRows:ByUID:{OrderRowUID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -1773,7 +1773,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dbController.OrderRowGetByUID(OrderRowUID);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
activity?.SetTag("data.source", source);
LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -1938,7 +1938,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Phases:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -1949,7 +1949,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.PhasesGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -1973,7 +1973,7 @@ namespace EgwCoreLib.Lux.Data.Services
Dictionary>? result = null;
// cerco in redis...
string currKey = $"{redisBaseKey}:PlannerData:{dtStart:yyyyMMdd}:{dtEnd:yyyyMMdd}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue && rawData.Length() > 2)
{
@@ -1985,7 +1985,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = dataSimController.PlannerGetEvents(dtStart, dtEnd);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
activity?.SetTag("data.source", source);
LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -2004,7 +2004,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdGroup:OrdRowId:{OrderRowID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2015,7 +2015,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdGroupByOrderRow(OrderRowID);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2038,7 +2038,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdGroup:OrdRowState:{reqState}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2049,7 +2049,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdGroupByOrderState(reqState);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2140,7 +2140,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdItems:OrdRowId:{OrderRowId}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2151,7 +2151,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdItemByOrderRow(OrderRowId);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2192,7 +2192,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdOdl:Unassigned";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2203,7 +2203,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdOdlAssignGetAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2226,7 +2226,7 @@ namespace EgwCoreLib.Lux.Data.Services
ProductionODLModel? result = null;
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdOdl:{uID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject($"{rawData}");
@@ -2237,7 +2237,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdOdlGetByUidAsync(uID);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
activity?.SetTag("data.source", source);
LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
@@ -2272,7 +2272,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:ProdPlantList";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2283,7 +2283,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ProdPlantGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -2357,7 +2357,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Resources:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2368,7 +2368,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.ResourcesGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2448,7 +2448,7 @@ namespace EgwCoreLib.Lux.Data.Services
await dbController.ProdOdlUpdateBomAsync(uID, bomContent);
// salvo in cache BOM aggiornata...
string currKey = $"{redisBaseKey}:ProdOdl:{uID}";
- await redisDb.StringSetAsync(currKey, bomContent, LongCache);
+ await _redisDb.StringSetAsync(currKey, bomContent, LongCache);
break;
default:
@@ -2623,7 +2623,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:SellingItem:{envir}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2634,7 +2634,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.SellingItemsByEnvir(envir);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -2660,7 +2660,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:SellingItem:{envir}:{sourceType}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2671,7 +2671,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.SellingItemGetFiltAsync(envir, sourceType);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2759,7 +2759,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Tags:ALL";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = _redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2770,7 +2770,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.TagsGetAllAsync();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, UltraLongCache);
+ _redisDb.StringSet(currKey, rawData, UltraLongCache);
}
if (result == null)
{
@@ -2833,7 +2833,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Template:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -2845,7 +2845,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.TemplateGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2869,7 +2869,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:TemplateRow:{templateID}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -2881,7 +2881,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.TemplateRowByParentAsync(templateID);
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -2965,7 +2965,7 @@ namespace EgwCoreLib.Lux.Data.Services
List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:TemplateRow:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ RedisValue rawData = await _redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
@@ -2977,7 +2977,7 @@ namespace EgwCoreLib.Lux.Data.Services
result = await dbController.TemplateRowGetAllAsync();
// serializzo e salvo con config x evitare loop...
rawData = JsonConvert.SerializeObject(result, JSSettings);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ await _redisDb.StringSetAsync(currKey, rawData, LongCache);
}
if (result == null)
{
@@ -3146,7 +3146,7 @@ namespace EgwCoreLib.Lux.Data.Services
///
protected new void LogTrace(string traceMsg, NLog.LogLevel? reqLevel = null, [CallerMemberName] string? methodName = null)
{
- if (!traceEnabled)
+ if (!_traceEnabled)
return;
reqLevel ??= NLog.LogLevel.Debug;
@@ -3171,10 +3171,10 @@ namespace EgwCoreLib.Lux.Data.Services
* - prendo solo NON repliche (= master)
* - me ne aspetto 1 in uscita cmq
*******************************/
- var connServ = redisConn.GetEndPoints()
+ var connServ = _redisConn.GetEndPoints()
.Select(endpoint =>
{
- var server = redisConn.GetServer(endpoint);
+ var server = _redisConn.GetServer(endpoint);
return server;
})
.Where(x => x.IsConnected && !x.IsReplica)
@@ -3186,11 +3186,11 @@ namespace EgwCoreLib.Lux.Data.Services
// sepattern è "*" elimino intero DB...
if ((pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
{
- connServ.FlushDatabase(database: redisDb.Database);
+ connServ.FlushDatabase(database: _redisDb.Database);
}
else
{
- var keys = connServ.Keys(database: redisDb.Database, pattern: pat2Flush, pageSize: 1000);
+ var keys = connServ.Keys(database: _redisDb.Database, pattern: pat2Flush, pageSize: 1000);
var batch = new List();
foreach (var key in keys)
{
@@ -3200,7 +3200,7 @@ namespace EgwCoreLib.Lux.Data.Services
if (batch.Count >= 1000)
{
foreach (var item in batch)
- redisDb.KeyDelete(item);
+ _redisDb.KeyDelete(item);
batch.Clear();
}
@@ -3208,7 +3208,7 @@ namespace EgwCoreLib.Lux.Data.Services
// Flush remaining keys
foreach (var item in batch)
- redisDb.KeyDelete(item);
+ _redisDb.KeyDelete(item);
}
answ = true;
}
@@ -3252,10 +3252,10 @@ namespace EgwCoreLib.Lux.Data.Services
* - prendo solo NON repliche (= master)
* - me ne aspetto 1 in uscita / prendo primo o default
*******************************/
- var connServ = redisConn.GetEndPoints()
+ var connServ = _redisConn.GetEndPoints()
.Select(endpoint =>
{
- var server = redisConn.GetServer(endpoint);
+ var server = _redisConn.GetServer(endpoint);
return server;
})
.Where(x => x.IsConnected && !x.IsReplica)
@@ -3266,18 +3266,18 @@ namespace EgwCoreLib.Lux.Data.Services
// se pat2Flush è "*" elimino intero DB...
if ((pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
{
- connServ.FlushDatabase(database: redisDb.Database);
+ connServ.FlushDatabase(database: _redisDb.Database);
}
else
{
try
{
- var keys = connServ.Keys(database: redisDb.Database, pattern: pat2Flush, pageSize: 1000);
+ var keys = connServ.Keys(database: _redisDb.Database, pattern: pat2Flush, pageSize: 1000);
var deleteTasks = new List();
foreach (var key in keys)
{
- deleteTasks.Add(redisDb.KeyDeleteAsync(key));
+ deleteTasks.Add(_redisDb.KeyDeleteAsync(key));
if (deleteTasks.Count >= 1000)
{
await Task.WhenAll(deleteTasks);
diff --git a/EgwCoreLib.Lux.Data/Services/ProdService.cs b/EgwCoreLib.Lux.Data/Services/ProdService.cs
index 0fb7b1bb..25f988a2 100644
--- a/EgwCoreLib.Lux.Data/Services/ProdService.cs
+++ b/EgwCoreLib.Lux.Data/Services/ProdService.cs
@@ -5,8 +5,6 @@ using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
-using System;
-using System.Collections.Generic;
using System.Diagnostics;
using static Egw.Window.Data.Enums;
@@ -20,7 +18,7 @@ namespace EgwCoreLib.Lux.Data.Services
{
// conf redis service
_redisService = redisService;
- _db = redisConn.GetDatabase();
+ _db = _redisConn.GetDatabase();
chPub = _config.GetValue("ServerConf:ChannelPub") ?? "";
Log.Info($"ProdService | Init OK");
}
diff --git a/EgwCoreLib.Lux.Data/Services/Utils/GenClassService.cs b/EgwCoreLib.Lux.Data/Services/Utils/GenClassService.cs
new file mode 100644
index 00000000..bfd25436
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Services/Utils/GenClassService.cs
@@ -0,0 +1,41 @@
+using EgwCoreLib.Lux.Data.DbModel.Utils;
+using EgwCoreLib.Lux.Data.Repository.Utils;
+using Microsoft.Extensions.Configuration;
+using StackExchange.Redis;
+
+namespace EgwCoreLib.Lux.Data.Services.Utils
+{
+ public class GenClassService : BaseServ, IGenClassService
+ {
+ private readonly IGenClassRepository _repo;
+
+ public GenClassService(
+ IConfiguration config,
+ IConnectionMultiplexer redis,
+ IGenClassRepository repo) : base(config, redis)
+ {
+ _repo = repo;
+ }
+
+ public async Task> GetAllAsync()
+ {
+ return await GetOrSetCacheAsync($"{redisBaseKey}:GenClass",
+ () => _repo.GetAllWithNavAsync());
+ }
+
+ public async Task DeleteAsync(GenClassModel model)
+ {
+ return await TraceAsync("GenClass.Delete", async (activity) =>
+ {
+ var record = await _repo.GetByCodeAsync(model.ClassCod);
+ if (record == null) return false;
+
+ _repo.Delete(record);
+ bool ok = await _repo.SaveChangesAsync();
+
+ if (ok) await ClearCacheAsync($"{redisBaseKey}:GenClass*");
+ return ok;
+ });
+ }
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/Utils/IGenClassService.cs b/EgwCoreLib.Lux.Data/Services/Utils/IGenClassService.cs
new file mode 100644
index 00000000..79f977d8
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Services/Utils/IGenClassService.cs
@@ -0,0 +1,10 @@
+using EgwCoreLib.Lux.Data.DbModel.Utils;
+
+namespace EgwCoreLib.Lux.Data.Services.Utils
+{
+ public interface IGenClassService
+ {
+ Task> GetAllAsync();
+ Task DeleteAsync(GenClassModel model);
+ }
+}
diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj
index 1b27dd07..11c87d0f 100644
--- a/Lux.API/Lux.API.csproj
+++ b/Lux.API/Lux.API.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 1.1.2603.1317
+ 1.1.2603.1407
diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs
index 5dc54be4..335f83e6 100644
--- a/Lux.API/Program.cs
+++ b/Lux.API/Program.cs
@@ -141,6 +141,22 @@ builder.Services.AddSingleton();
builder.Services.AddHostedService();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
+
+// registrazione automatica Repository e Servizi con Scrutor
+builder.Services.Scan(scan => scan
+ .FromAssemblyOf() // Cerca nell'assembly dove si trova BaseServ
+
+ // Registra tutti i Repository
+ .AddClasses(classes => classes.Where(c => c.Name.EndsWith("Repository")))
+ .AsImplementedInterfaces() // Es: associa GenClassRepository a IGenClassRepository
+ .WithScopedLifetime()
+
+ // Registra tutti i Servizi
+ .AddClasses(classes => classes.Where(c => c.Name.EndsWith("Service")))
+ .AsImplementedInterfaces()
+ .WithScopedLifetime()
+);
+
// init servizio gestone ReqIndex
string cleanupDayTTL = configuration.GetValue("ServerConf:CleanupDayTTL") ?? "360";
string rBaseKey = configuration.GetValue("ServerConf:RedisBaseKey") ?? "Lux";
diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj
index 821bd127..97384772 100644
--- a/Lux.UI/Lux.UI.csproj
+++ b/Lux.UI/Lux.UI.csproj
@@ -5,7 +5,7 @@
enable
enable
aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50
- 1.1.2603.1317
+ 1.1.2603.1407
diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs
index d470b5ce..e3054dab 100644
--- a/Lux.UI/Program.cs
+++ b/Lux.UI/Program.cs
@@ -155,13 +155,29 @@ builder.Services.AddSingleton(redisConn);
builder.Services.AddSingleton();
builder.Services.AddSingleton();
// Aggiunta servizi specifici
-builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
+builder.Services.AddSingleton();
+
+// registrazione automatica Repository e Servizi con Scrutor
+builder.Services.Scan(scan => scan
+ .FromAssemblyOf() // Cerca nell'assembly dove si trova BaseServ
+
+ // Registra tutti i Repository
+ .AddClasses(classes => classes.Where(c => c.Name.EndsWith("Repository")))
+ .AsImplementedInterfaces() // Es: associa GenClassRepository a IGenClassRepository
+ .WithScopedLifetime()
+
+ // Registra tutti i Servizi
+ .AddClasses(classes => classes.Where(c => c.Name.EndsWith("Service")))
+ .AsImplementedInterfaces()
+ .WithScopedLifetime()
+);
+
// init servizio gestone ReqIndex
string cleanupDayTTL = configuration.GetValue("ServerConf:CleanupDayTTL") ?? "360";
string rBaseKey = configuration.GetValue("ServerConf:RedisBaseKey") ?? "Lux";
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 7f6d4e18..460ae571 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
LUX - Web Windows MES
- Versione: 1.1.2603.1317
+ Versione: 1.1.2603.1407
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index c15eb1cd..68d33e37 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-1.1.2603.1317
+1.1.2603.1407
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index 30c66ea5..74ebe929 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 1.1.2603.1317
+ 1.1.2603.1407
http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip
http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html
false