Fix dipendenze servizi
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.21" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.21" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.21" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.23" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageVersion Include="NLog" Version="6.1.2" />
|
||||
<PackageVersion Include="NLog.Web.AspNetCore" Version="6.1.0" />
|
||||
|
||||
+36
-4
@@ -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<IDistributedCache>())
|
||||
.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<DataLayerContext>(options =>
|
||||
{
|
||||
var conn = builder.Configuration.GetConnectionString("Lux.All");
|
||||
options.UseMySql(conn, ServerVersion.AutoDetect(conn), mySqlOptions =>
|
||||
{
|
||||
mySqlOptions.EnableStringComparisonTranslations();
|
||||
@@ -40,9 +60,21 @@ builder.Services.AddDbContextFactory<DataLayerContext>(options =>
|
||||
.EnableDetailedErrors(false)
|
||||
.LogTo(_ => { }); // disabilita EF logging;
|
||||
});
|
||||
|
||||
builder.Services.AddDbContextFactory<ReportContext>(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<IConnectionMultiplexer>(redisConn);
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMPlexer);
|
||||
// registro wrapper servizi REDIS
|
||||
builder.Services.AddSingleton<IRedisService, RedisService>();
|
||||
builder.Services.AddSingleton<RedisSubscriptionManager>();
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Egw.Data" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" />
|
||||
<PackageReference Include="NLog" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" />
|
||||
<ProjectReference Include="..\Test.UI.Client\Test.UI.Client.csproj" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>3.1.9.811</Version>
|
||||
<Version>3.1.9.817</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
|
||||
@@ -138,6 +138,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>3.1.9.811</Version>
|
||||
<Version>3.1.9.817</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione JWD per LUX</Description>
|
||||
@@ -237,6 +237,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user