96 lines
3.3 KiB
C#
96 lines
3.3 KiB
C#
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.Dossier;
|
|
using MP.Data.Repository.FluxLog;
|
|
using MP.Data.Repository.IOC;
|
|
using MP.Data.Repository.Mtc;
|
|
using MP.Data.Repository.Production;
|
|
using MP.Data.Repository.System;
|
|
using MP.Data.Repository.Utils;
|
|
using MP.Data.Services;
|
|
using MP.Data.Services.IOC;
|
|
using MP.Data.Services.Mtc;
|
|
using MP.Data.Services.Utils;
|
|
|
|
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
|
|
services.TryAddSingleton<IMtcSetupRepository, MtcSetupRepository>();
|
|
|
|
// Repository Scoped
|
|
services.TryAddScoped<IIocRepository, IocRepository>();
|
|
services.TryAddScoped<IStatsAggrRepository, StatsAggrRepository>();
|
|
services.TryAddScoped<IStatsDetailRepository, StatsDetailRepository>();
|
|
|
|
// Servizi Singleton
|
|
services.TryAddSingleton<IMtcSetupService, MtcSetupService>();
|
|
services.TryAddSingleton<MpIocController>();
|
|
|
|
// Servizi Scoped
|
|
services.TryAddScoped<IIocService, IocService>();
|
|
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
|
|
services.TryAddScoped<IProductionRepository, ProductionRepository>();
|
|
services.TryAddScoped<IDossierRepository, DossierRepository>();
|
|
services.TryAddScoped<IFluxLogRepository, FluxLogRepository>();
|
|
services.TryAddScoped<ISystemRepository, SystemRepository>();
|
|
|
|
|
|
// ---------- 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;
|
|
}
|
|
}
|
|
}
|