diff --git a/MP-TAB/MP-TAB.Client/Program.cs b/MP-TAB/MP-TAB.Client/Program.cs index feda30c3..e5f737cb 100644 --- a/MP-TAB/MP-TAB.Client/Program.cs +++ b/MP-TAB/MP-TAB.Client/Program.cs @@ -6,6 +6,7 @@ using MP.Data.Services; var builder = WebAssemblyHostBuilder.CreateDefault(args); // servizio cache locale dati +builder.Services.AddSingleton(); builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); diff --git a/MP-TAB/MP-TAB/Components/Layout/MainLayout.razor b/MP-TAB/MP-TAB/Components/Layout/MainLayout.razor index bc433fe0..1871fd9a 100644 --- a/MP-TAB/MP-TAB/Components/Layout/MainLayout.razor +++ b/MP-TAB/MP-TAB/Components/Layout/MainLayout.razor @@ -2,7 +2,7 @@ @inject NavigationManager NavMan @inject ListSelectDataSrv MDataService -@inject MemStorUtil MStor +@inject SharedMemService MStor
diff --git a/MP-TAB/MP-TAB/Program.cs b/MP-TAB/MP-TAB/Program.cs index 5a44df65..0d6786f7 100644 --- a/MP-TAB/MP-TAB/Program.cs +++ b/MP-TAB/MP-TAB/Program.cs @@ -20,6 +20,7 @@ builder.Services.AddSingleton(redisMultiplexer); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); diff --git a/MP.Data/MP - Backup.Data.csproj b/MP.Data/MP - Backup.Data.csproj deleted file mode 100644 index 1d0ec037..00000000 --- a/MP.Data/MP - Backup.Data.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net6.0 - MP.Data - MP.Data - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - \ No newline at end of file diff --git a/MP.Data/Services/SharedMemService.cs b/MP.Data/Services/SharedMemService.cs new file mode 100644 index 00000000..ccc35c93 --- /dev/null +++ b/MP.Data/Services/SharedMemService.cs @@ -0,0 +1,49 @@ +using MP.Data.DatabaseModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.Services +{ + public class SharedMemService + { + + /// + /// Dizionario macchine (shared) + /// + public Dictionary DictMacchine { get; set; } = new Dictionary(); + + /// + /// Dizionario Menu + /// + public Dictionary> DictMenu { get; set; } = new Dictionary>(); + + /// + /// Reset cache memory + /// + public void ResetCache() + { + DictMacchine = new Dictionary(); + DictMenu = new Dictionary>(); + } + + /// + /// Restituisce il livello pagina dato URL + /// - se contiene ?IdxMacc --> T2D (detail) + /// - altrimenti --> T2H + /// + /// + /// + public string PageLevel(string pageUrl) + { + string answ = "T2H"; + if (pageUrl.Contains("?IdxMacc=")) + { + answ = "T2D"; + } + return answ; + } + } +}