diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
index 74964898..174b91d9 100644
--- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
+++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs
@@ -140,6 +140,7 @@ namespace EgwCoreLib.Lux.Data.Controllers
return dbResult;
}
+#if true
///
/// Elenco completo ItemGroup gestiti
///
@@ -187,6 +188,7 @@ namespace EgwCoreLib.Lux.Data.Controllers
}
return dbResult;
}
+#endif
internal async Task OffersCheckExpired()
{
diff --git a/EgwCoreLib.Lux.Data/Repository/Items/IItemGroupRepository.cs b/EgwCoreLib.Lux.Data/Repository/Items/IItemGroupRepository.cs
new file mode 100644
index 00000000..77883751
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/Items/IItemGroupRepository.cs
@@ -0,0 +1,9 @@
+using EgwCoreLib.Lux.Data.DbModel.Items;
+
+namespace EgwCoreLib.Lux.Data.Repository.Items
+{
+ public interface IItemGroupRepository
+ {
+ Task> GetAllAsync();
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Repository/Items/ItemGroupRepository.cs b/EgwCoreLib.Lux.Data/Repository/Items/ItemGroupRepository.cs
new file mode 100644
index 00000000..a48d051f
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Repository/Items/ItemGroupRepository.cs
@@ -0,0 +1,28 @@
+using EgwCoreLib.Lux.Data.DbModel.Items;
+using Microsoft.EntityFrameworkCore;
+
+namespace EgwCoreLib.Lux.Data.Repository.Items
+{
+ public class ItemGroupRepository : BaseRepository, IItemGroupRepository
+ {
+ #region Public Constructors
+
+ public ItemGroupRepository(IDbContextFactory ctxFactory) : base(ctxFactory)
+ {
+ }
+
+ #endregion Public Constructors
+
+ #region Public Methods
+
+ public async Task> GetAllAsync()
+ {
+ await using var dbCtx = await CreateContextAsync();
+ return await dbCtx.DbSetItemGroup
+ .AsNoTracking()
+ .ToListAsync();
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/Config/EnvirParamService.cs b/EgwCoreLib.Lux.Data/Services/Config/EnvirParamService.cs
index 0df807c1..5d7f8895 100644
--- a/EgwCoreLib.Lux.Data/Services/Config/EnvirParamService.cs
+++ b/EgwCoreLib.Lux.Data/Services/Config/EnvirParamService.cs
@@ -24,7 +24,6 @@ namespace EgwCoreLib.Lux.Data.Services.Config
public async Task> GetAllAsync()
{
- // Uso helper TraceAsync che gestisce automaticamente StartActivity, Log e Exception tracking
return await TraceAsync($"{_className}.GetAll", async (activity) =>
{
return await GetOrSetCacheAsync(
diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
index 6fbacc86..ba3315a4 100644
--- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
+++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs
@@ -167,6 +167,7 @@ namespace EgwCoreLib.Lux.Data.Services
return answ;
}
+#if true
///
/// Elenco completo ItemGroup gestiti
///
@@ -199,6 +200,7 @@ namespace EgwCoreLib.Lux.Data.Services
LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms");
return result;
}
+#endif
///
/// Verifica offerte scadute, con update sul DB
diff --git a/EgwCoreLib.Lux.Data/Services/Items/IItemGroupService.cs b/EgwCoreLib.Lux.Data/Services/Items/IItemGroupService.cs
new file mode 100644
index 00000000..d2c3daeb
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Services/Items/IItemGroupService.cs
@@ -0,0 +1,9 @@
+using EgwCoreLib.Lux.Data.DbModel.Items;
+
+namespace EgwCoreLib.Lux.Data.Services.Items
+{
+ public interface IItemGroupService
+ {
+ Task> GetAllAsync();
+ }
+}
diff --git a/EgwCoreLib.Lux.Data/Services/Items/ItemGroupService.cs b/EgwCoreLib.Lux.Data/Services/Items/ItemGroupService.cs
new file mode 100644
index 00000000..27809f3c
--- /dev/null
+++ b/EgwCoreLib.Lux.Data/Services/Items/ItemGroupService.cs
@@ -0,0 +1,46 @@
+using EgwCoreLib.Lux.Data.DbModel.Items;
+using EgwCoreLib.Lux.Data.Repository.Items;
+using Microsoft.Extensions.Configuration;
+using StackExchange.Redis;
+
+namespace EgwCoreLib.Lux.Data.Services.Items
+{
+ public class ItemGroupService : BaseServ, IItemGroupService
+ {
+ #region Public Constructors
+
+ public ItemGroupService(
+ IConfiguration config,
+ IConnectionMultiplexer redis,
+ IItemGroupRepository repo) : base(config, redis)
+ {
+ _className = "ItemGroup";
+ _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 IItemGroupRepository _repo;
+
+ #endregion Private Fields
+ }
+}