Update x prima integrazione vocabolario

This commit is contained in:
Samuele Locatelli
2026-06-04 09:23:17 +02:00
parent 9113d9f279
commit 4d79061eda
12 changed files with 223 additions and 151 deletions
+16 -3
View File
@@ -1,9 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.OpenApi.Models;
using NLog.Targets;
using NLog.Web;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Backplane.StackExchangeRedis;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
//using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
@@ -21,7 +25,16 @@ logger.Info($"Current ASPNETCORE_ENVIRONMENT: {env.EnvironmentName}");
// costruzione connectionMultiplexer redis...
string connStr = configuration.GetConnectionString("Redis") ?? "localhost";
ConnectionMultiplexer redisConn = ConnectionMultiplexer.Connect(connStr);
IConnectionMultiplexer redisMPlex = ConnectionMultiplexer.Connect(connStr);
// ✅ FusionCache
builder.Services.AddFusionCache()
.WithDistributedCache(sp => sp.GetRequiredService<IDistributedCache>())
.WithSerializer(new FusionCacheNewtonsoftJsonSerializer())
.WithBackplane(new RedisBackplane(new RedisBackplaneOptions
{
ConnectionMultiplexerFactory = () => Task.FromResult(redisMPlex)
}));
// ====================================================================
// Setup Tracing e Telemetria...
@@ -51,7 +64,7 @@ if (otelEnabled)
.AddSource("Lux.UI")
.AddAspNetCoreInstrumentation(options => { options.Filter = ctx => !ctx.Request.Path.StartsWithSegments("/health"); })
.AddEntityFrameworkCoreInstrumentation()
.AddRedisInstrumentation(redisConn);
.AddRedisInstrumentation(redisMPlex);
// ====================================================================
// ESPORTAZIONE DI RETE (Solo Livelli 1 e 2)
@@ -129,7 +142,7 @@ builder.Services.AddSwaggerGen(c =>
// registro connMultiplexer REDIS
builder.Services.AddSingleton<IConnectionMultiplexer>(redisConn);
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMPlex);
var connectionString = builder.Configuration.GetConnectionString("Lux.All") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
// DataLayerContext (manca!)