diff --git a/Directory.Packages.props b/Directory.Packages.props index b6c0282..b45d773 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -16,6 +16,7 @@ + diff --git a/Test.UI/Program.cs b/Test.UI/Program.cs index 7ef7c3f..8061564 100644 --- a/Test.UI/Program.cs +++ b/Test.UI/Program.cs @@ -1,12 +1,16 @@ -using EgwCoreLib.Lux.Data; +using EgwCoreLib.Lux.Data; using EgwCoreLib.Lux.Data.Services.General; using EgwCoreLib.Lux.Data.Services.Internal; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Distributed; using NLog; using NLog.Web; using StackExchange.Redis; using System.Reflection; using Test.UI.Components; +using ZiggyCreatures.Caching.Fusion; +using ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis; +using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson; var builder = WebApplication.CreateBuilder(args); @@ -26,12 +30,28 @@ builder.Services.AddRazorComponents() // costruzione connectionMultiplexer redis... string connStr = configuration.GetConnectionString("Redis") ?? "localhost"; -ConnectionMultiplexer redisConn = ConnectionMultiplexer.Connect(connStr); +IConnectionMultiplexer redisMPlexer = ConnectionMultiplexer.Connect(connStr); + +// ✅ Distributed cache (necessario per FusionCache) +builder.Services.AddStackExchangeRedisCache(options => +{ + options.Configuration = connStr; +}); +// ✅ FusionCache +builder.Services.AddFusionCache() + .WithDistributedCache(sp => sp.GetRequiredService()) + .WithSerializer(new FusionCacheNewtonsoftJsonSerializer()) + .WithBackplane(new RedisBackplane(new RedisBackplaneOptions + { + ConnectionMultiplexerFactory = () => Task.FromResult(redisMPlexer) + })); + // registrazione in blocco servizi con metodo extension custom var connectionString = builder.Configuration.GetConnectionString("Lux.All") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); + +var conn = builder.Configuration.GetConnectionString("Lux.All"); builder.Services.AddDbContextFactory(options => { - var conn = builder.Configuration.GetConnectionString("Lux.All"); options.UseMySql(conn, ServerVersion.AutoDetect(conn), mySqlOptions => { mySqlOptions.EnableStringComparisonTranslations(); @@ -40,9 +60,21 @@ builder.Services.AddDbContextFactory(options => .EnableDetailedErrors(false) .LogTo(_ => { }); // disabilita EF logging; }); + +builder.Services.AddDbContextFactory(options => +{ + options.UseMySql(conn, ServerVersion.AutoDetect(conn), mySqlOptions => + { + mySqlOptions.EnableStringComparisonTranslations(); + }) + .EnableSensitiveDataLogging(false) + .EnableDetailedErrors(true); + //.LogTo(_ => { }, Microsoft.Extensions.Logging.LogLevel.None); // disabilita EF logging +}); + builder.Services.AddLuxData(connectionString); // registro connMultiplexer REDIS -builder.Services.AddSingleton(redisConn); +builder.Services.AddSingleton(redisMPlexer); // registro wrapper servizi REDIS builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index 5a28d9b..12343bd 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -28,6 +28,7 @@ all + diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index bbeb129..d8c53bc 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.9.811 + 3.1.9.817 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -138,6 +138,14 @@ + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 97e5eed..fd4ed32 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.9.811 + 3.1.9.817 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -237,6 +237,14 @@ + + + + + + + +