diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
index 6e1127b4..8f2a7b66 100644
--- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
+++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
@@ -7,7 +7,6 @@ using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
using EgwCoreLib.Lux.Data.DbModel.Stats;
-using EgwCoreLib.Lux.Data.DbModel.Utils;
using EgwCoreLib.Lux.Data.Domains;
using EgwMultiEngineManager.Data;
using Microsoft.EntityFrameworkCore;
@@ -1179,30 +1178,6 @@ namespace EgwCoreLib.Lux.Data.Controllers
return answ;
}
- /// > TagsGetAllAsync()
- {
- List
> GetAllAsync();
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Repository/Utils/TagRepository.cs b/EgwCoreLib.Lux.Data/Repository/Utils/TagRepository.cs
new file mode 100644
index 00000000..200e38f1
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/Utils/TagRepository.cs
@@ -0,0 +1,28 @@
+using EgwCoreLib.Lux.Data.DbModel.Utils;
+using Microsoft.EntityFrameworkCore;
+
+namespace EgwCoreLib.Lux.Data.Repository.Utils
+{
+ public class TagRepository : BaseRepository, ITagRepository
+ {
+ #region Public Constructors
+
+ public TagRepository(IDbContextFactory
> GetAllAsync()
+ {
+ await using var dbCtx = await CreateContextAsync();
+ return await dbCtx.DbSetTags
+ .AsNoTracking()
+ .ToListAsync();
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
index 995bfffb..c305a4fc 100644
--- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
+++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
@@ -5,7 +5,6 @@ using EgwCoreLib.Lux.Data.DbModel.Cost;
using EgwCoreLib.Lux.Data.DbModel.Job;
using EgwCoreLib.Lux.Data.DbModel.Production;
using EgwCoreLib.Lux.Data.DbModel.Sales;
-using EgwCoreLib.Lux.Data.DbModel.Utils;
using EgwMultiEngineManager.Data;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
@@ -642,40 +641,6 @@ namespace EgwCoreLib.Lux.Data.Services
}
}
- ///
> TagsGetAllAsync()
- {
- using var activity = StartActivity();
- string source = "DB";
- List
>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await dbController.TagsGetAllAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- _redisDb.StringSet(currKey, rawData, UltraLongCache);
- }
- if (result == null)
- {
- result = new List
> GetAllAsync();
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/Utils/TagService.cs b/EgwCoreLib.Lux.Data/Services/Utils/TagService.cs
new file mode 100644
index 00000000..5c3fb1f6
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Services/Utils/TagService.cs
@@ -0,0 +1,46 @@
+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 TagService : BaseServ, ITagService
+ {
+ #region Public Constructors
+
+ public TagService(
+ IConfiguration config,
+ IConnectionMultiplexer redis,
+ ITagRepository repo) : base(config, redis)
+ {
+ _className = "Tag";
+ _repo = repo;
+ }
+
+ #endregion Public Constructors
+
+ #region Public Methods
+
+ public async Task
> GetAllAsync()
+ {
+ return await TraceAsync($"{_className}.GetAll", async (activity) =>
+ {
+ return await GetOrSetCacheAsync(
+ $"{_redisBaseKey}:{_className}:ALL",
+ async () => await _repo.GetAllAsync(),
+ UltraLongCache
+ );
+ });
+ }
+
+ #endregion Public Methods
+
+ #region Private Fields
+
+ private readonly string _className;
+ private readonly ITagRepository _repo;
+
+ #endregion Private Fields
+ }
+}
diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs
index a7eb7aa0..0f946194 100644
--- a/Lux.API/Program.cs
+++ b/Lux.API/Program.cs
@@ -196,6 +196,7 @@ builder.Services.AddScoped
-