This commit is contained in:
zaccaria.majid
2023-10-02 10:41:54 +02:00
5 changed files with 52 additions and 20 deletions
+1
View File
@@ -6,6 +6,7 @@ using MP.Data.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// servizio cache locale dati
builder.Services.AddSingleton<SharedMemService>();
builder.Services.AddScoped<MemStorUtil>();
//builder.Services.AddScoped<MessageService>();
builder.Services.AddBlazoredLocalStorage();
@@ -2,7 +2,7 @@
@inject NavigationManager NavMan
@inject ListSelectDataSrv MDataService
@inject MemStorUtil MStor
@inject SharedMemService MStor
<div class="page">
+1
View File
@@ -20,6 +20,7 @@ builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
builder.Services.AddSingleton<StatusData>();
builder.Services.AddSingleton<ListSelectDataSrv>();
builder.Services.AddSingleton<OrderDataSrv>();
builder.Services.AddSingleton<SharedMemService>();
builder.Services.AddScoped<UserServ>();
builder.Services.AddScoped<MemStorUtil>();
//builder.Services.AddScoped<MessageService>();
-19
View File
@@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>MP.Data</AssemblyName>
<RootNamespace>MP.Data</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NLog" Version="4.7.10" />
</ItemGroup>
</Project>
+49
View File
@@ -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
{
/// <summary>
/// Dizionario macchine (shared)
/// </summary>
public Dictionary<string, string> DictMacchine { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Dizionario Menu
/// </summary>
public Dictionary<string, List<LinkMenu>> DictMenu { get; set; } = new Dictionary<string, List<LinkMenu>>();
/// <summary>
/// Reset cache memory
/// </summary>
public void ResetCache()
{
DictMacchine = new Dictionary<string, string>();
DictMenu = new Dictionary<string, List<LinkMenu>>();
}
/// <summary>
/// Restituisce il livello pagina dato URL
/// - se contiene ?IdxMacc --> T2D (detail)
/// - altrimenti --> T2H
/// </summary>
/// <param name="pageUrl"></param>
/// <returns></returns>
public string PageLevel(string pageUrl)
{
string answ = "T2H";
if (pageUrl.Contains("?IdxMacc="))
{
answ = "T2D";
}
return answ;
}
}
}