diff --git a/EgwCoreLib.Lux.Data/DataServiceCollectionExtensions.cs b/EgwCoreLib.Lux.Data/DataServiceCollectionExtensions.cs index d7c9b022..1f95e4b1 100644 --- a/EgwCoreLib.Lux.Data/DataServiceCollectionExtensions.cs +++ b/EgwCoreLib.Lux.Data/DataServiceCollectionExtensions.cs @@ -29,7 +29,12 @@ namespace EgwCoreLib.Lux.Data //services.AddDbContextFactory(options => // options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString))); - // Repository con interfaccia + // servizi preliminari + //services.TryAddSingleton(redisConn); + services.TryAddSingleton(); + services.TryAddSingleton(); + + // Repository Scoped services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); @@ -61,7 +66,7 @@ namespace EgwCoreLib.Lux.Data services.TryAddScoped(); services.TryAddScoped(); - // Servizi dati con interfaccia + // Servizi Scoped services.TryAddScoped(); services.TryAddScoped(); services.TryAddScoped(); diff --git a/EgwCoreLib.Lux.Data/Services/General/IRedisService.cs b/EgwCoreLib.Lux.Data/Services/General/IRedisService.cs index d2dfc4e4..8ceffcdf 100644 --- a/EgwCoreLib.Lux.Data/Services/General/IRedisService.cs +++ b/EgwCoreLib.Lux.Data/Services/General/IRedisService.cs @@ -1,6 +1,6 @@ using StackExchange.Redis; -namespace EgwCoreLib.Lux.Data.Services +namespace EgwCoreLib.Lux.Data.Services.General { /// /// Interfaccia servizio REDIS x pub/sub e caching diff --git a/EgwCoreLib.Lux.Data/Services/General/RedisService.cs b/EgwCoreLib.Lux.Data/Services/General/RedisService.cs index 79bffb74..7d4b787a 100644 --- a/EgwCoreLib.Lux.Data/Services/General/RedisService.cs +++ b/EgwCoreLib.Lux.Data/Services/General/RedisService.cs @@ -2,7 +2,7 @@ using NLog; using StackExchange.Redis; -namespace EgwCoreLib.Lux.Data.Services +namespace EgwCoreLib.Lux.Data.Services.General { /// /// Implementazione interfaccia REDIS: @@ -342,21 +342,20 @@ namespace EgwCoreLib.Lux.Data.Services #endregion Public Methods - #region Protected Fields + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + private readonly IConnectionMultiplexer _connection; + + private readonly IDatabase _db; + + private readonly ISubscriber _subscriber; /// /// conf speciale serializzatore JSON /// - protected JsonSerializerSettings? JSSettings; - - #endregion Protected Fields - - #region Private Fields - - private static Logger Log = LogManager.GetCurrentClassLogger(); - private readonly IConnectionMultiplexer _connection; - private readonly IDatabase _db; - private readonly ISubscriber _subscriber; + private JsonSerializerSettings? JSSettings; #endregion Private Fields } diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index 8aee5545..154cf6fe 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -135,9 +135,12 @@ builder.Services.AddSwaggerGen(c => // registro connMultiplexer REDIS builder.Services.AddSingleton(redisConn); + +#if false // registro wrapper servizi REDIS builder.Services.AddSingleton(); -builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +#endif var connectionString = builder.Configuration.GetConnectionString("Lux.All") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); // DataLayerContext (manca!) diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs index cab053a6..67aa4c37 100644 --- a/Lux.UI/Program.cs +++ b/Lux.UI/Program.cs @@ -1,5 +1,4 @@ using EgwCoreLib.Lux.Data; -using EgwCoreLib.Lux.Data.Services; using Lux.UI.Components; using Lux.UI.Components.Account; using Lux.UI.Data; @@ -142,9 +141,12 @@ builder.Services.AddAuthentication(options => // registro connMultiplexer REDIS builder.Services.AddSingleton(redisConn); + +#if false // registro wrapper servizi REDIS builder.Services.AddSingleton(); -builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +#endif var conn = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");