@adesso |
Egalware
diff --git a/BlazorServerApp-2022/BlazorServerApp-2022/Program.cs b/BlazorServerApp-2022/BlazorServerApp-2022/Program.cs
index f17e942..22832df 100644
--- a/BlazorServerApp-2022/BlazorServerApp-2022/Program.cs
+++ b/BlazorServerApp-2022/BlazorServerApp-2022/Program.cs
@@ -1,12 +1,32 @@
using BlazorServerApp_2022.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
+using StackExchange.Redis;
+
var builder = WebApplication.CreateBuilder(args);
+/*--------------------
+ * Note migrazione startup.cs -_> program.cs:
+ *
+ * - https://stackoverflow.com/questions/69722872/asp-net-core-6-how-to-access-configuration-during-startup
+ * - https://docs.microsoft.com/en-us/aspnet/core/migration/50-to-60?view=aspnetcore-5.0&tabs=visual-studio#where-do-i-put-state-that-was-stored-as-fields-in-my-program-or-startup-class
+ *
+ * */
+
+ConfigurationManager configuration = builder.Configuration;
+
+// REDIS setup
+string connStringRedis = configuration.GetConnectionString("Redis");
+string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
+// avvio oggetto shared x redis...
+var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
+
+
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
+builder.Services.AddSingleton
(redisMultiplexer);
builder.Services.AddSingleton();
var app = builder.Build();
diff --git a/BlazorServerApp-2022/BlazorServerApp-2022/_Imports.razor b/BlazorServerApp-2022/BlazorServerApp-2022/_Imports.razor
index f357e0d..016faef 100644
--- a/BlazorServerApp-2022/BlazorServerApp-2022/_Imports.razor
+++ b/BlazorServerApp-2022/BlazorServerApp-2022/_Imports.razor
@@ -8,3 +8,4 @@
@using Microsoft.JSInterop
@using BlazorServerApp_2022
@using BlazorServerApp_2022.Shared
+@using BlazorServerApp_2022.Components
diff --git a/BlazorServerApp-2022/BlazorServerApp-2022/appsettings.json b/BlazorServerApp-2022/BlazorServerApp-2022/appsettings.json
index 10f68b8..5d591d5 100644
--- a/BlazorServerApp-2022/BlazorServerApp-2022/appsettings.json
+++ b/BlazorServerApp-2022/BlazorServerApp-2022/appsettings.json
@@ -5,5 +5,10 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "AllowedHosts": "*"
+ "AllowedHosts": "*",
+ "CodApp": "BlazorServerApp-2022",
+ "ConnectionStrings": {
+ "GPW.DB": "Server=SQL2016DEV;Database=MonPro_Anagrafica; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
+ "Redis": "localhost:6379,DefaultDatabase=13,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false"
+ }
}
diff --git a/BlazorServerApp-2022/BlazorServerApp-2022/logs/.placeholder b/BlazorServerApp-2022/BlazorServerApp-2022/logs/.placeholder
new file mode 100644
index 0000000..5f28270
--- /dev/null
+++ b/BlazorServerApp-2022/BlazorServerApp-2022/logs/.placeholder
@@ -0,0 +1 @@
+
\ No newline at end of file