Inizio setup repository

This commit is contained in:
Samuele Locatelli
2026-06-01 16:43:40 +02:00
parent 3ea4b77827
commit 5c20387e1d
21 changed files with 738 additions and 96 deletions
@@ -1,9 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using MP.AppAuth.Services;
using MP.Data.Controllers;
using MP.Data.Repository.Anag;
using MP.Data.Repository.IOC;
using MP.Data.Repository.Mtc;
using MP.Data.Repository.Utils;
using MP.Data.Services;
using MP.Data.Services.IOC;
using MP.Data.Services.Mtc;
using MP.Data.Services.Utils;
@@ -12,6 +15,11 @@ namespace MP.Data
{
public static class DataServiceCollectionExtensions
{
/// <summary>
/// Aggiunta repository/servizi specifici per IOC
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddIocDataLayer(this IServiceCollection services)
{
// Repository Singleton
@@ -31,6 +39,48 @@ namespace MP.Data
services.TryAddScoped<IStatsAggrService, StatsAggrService>();
services.TryAddScoped<IStatsDetailService, StatsDetailService>();
return services;
}
/// <summary>
/// Aggiunta repository/servizi specifici per SPEC
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddSpecDataLayer(this IServiceCollection services)
{
// ---------- Start Repository ----------
// Singleton
services.TryAddSingleton<IAnagRepository, AnagRepository>();
// Scoped
// ---------- End Repository ----------
// ---------- Start Servizi ----------
// Singleton
// Scoped
// ---------- End Servizi ----------
// ---------- Start Altro ----------
// Singleton
services.TryAddSingleton<AppAuthService>();
services.TryAddSingleton<ListSelectDataSrv>();
services.TryAddSingleton<SharedMemService>();
services.TryAddSingleton<TabDataService>();
services.TryAddSingleton<TabDataFeeder>();
// Scoped
services.AddScoped<ISessionStorageService, SessionStorageService>();
services.AddScoped<ILocalStorageService, LocalStorageService>();
// ---------- End Altro ----------
return services;
}
}