Files
lux/EgwCoreLib.Lux.Data/DataServiceCollectionExtensions.cs
T
2026-04-24 18:52:21 +02:00

122 lines
7.3 KiB
C#

using EgwCoreLib.Lux.Data.Repository.Report;
using EgwCoreLib.Lux.Data.Repository.Supplier;
using EgwCoreLib.Lux.Data.Services.Catalog;
using EgwCoreLib.Lux.Data.Services.Config;
using EgwCoreLib.Lux.Data.Services.Cost;
using EgwCoreLib.Lux.Data.Services.General;
using EgwCoreLib.Lux.Data.Services.Internal;
using EgwCoreLib.Lux.Data.Services.Items;
using EgwCoreLib.Lux.Data.Services.Job;
using EgwCoreLib.Lux.Data.Services.Production;
using EgwCoreLib.Lux.Data.Services.Report;
using EgwCoreLib.Lux.Data.Services.Sales;
using EgwCoreLib.Lux.Data.Services.Supplier;
using EgwCoreLib.Lux.Data.Services.Utils;
using EgwCoreLib.Lux.Data.Services.Warehouse;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace EgwCoreLib.Lux.Data
{
public static class DataServiceCollectionExtensions
{
public static IServiceCollection AddLuxData(this IServiceCollection services, string connectionString)
{
//// DbContextFactory: preferibile in Blazor Server e scenari concorrenti
//services.AddDbContextFactory<DataLayerContext>(options =>
// options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
// servizi preliminari
//services.TryAddSingleton<IConnectionMultiplexer>(redisConn);
services.TryAddSingleton<IRedisService, RedisService>();
services.TryAddSingleton<IRedisSubscriptionManager, RedisSubscriptionManager>();
// Repository Scoped
services.TryAddScoped<IBuyOrderRepository, BuyOrderRepository>();
services.TryAddScoped<IConfGlassRepository, ConfGlassRepository>();
services.TryAddScoped<IConfProfileRepository, ConfProfileRepository>();
services.TryAddScoped<IConfWoodRepository, ConfWoodRepository>();
services.TryAddScoped<ICostDriverRepository, CostDriverRepository>();
services.TryAddScoped<ICustomerRepository, CustomerRepository>();
services.TryAddScoped<IDealerRepository, DealerRepository>();
services.TryAddScoped<IEnvirParamRepository, EnvirParamRepository>();
services.TryAddScoped<IGenClassRepository, GenClassRepository>();
services.TryAddScoped<IGenValRepository, GenValRepository>();
services.TryAddScoped<IItemGroupRepository, ItemGroupRepository>();
services.TryAddScoped<IItemRepository, ItemRepository>();
services.TryAddScoped<IJobStepRepository, JobStepRepository>();
services.TryAddScoped<IJobTaskRepository, JobTaskRepository>();
services.TryAddScoped<IMatReqRepository, MatReqRepository>();
services.TryAddScoped<IOfferRepository, OfferRepository>();
services.TryAddScoped<IOfferRowRepository, OfferRowRepository>();
services.TryAddScoped<IOrderRepository, OrderRepository>();
services.TryAddScoped<IOrderRowRepository, OrderRowRepository>();
services.TryAddScoped<IPhaseRepository, PhaseRepository>();
services.TryAddScoped<IProductionBatchRepository, ProductionBatchRepository>();
services.TryAddScoped<IProductionGroupRepository, ProductionGroupRepository>();
services.TryAddScoped<IProductionItemRepository, ProductionItemRepository>();
services.TryAddScoped<IProductionOdlRepository, ProductionOdlRepository>();
services.TryAddScoped<IProductionPlantRepository, ProductionPlantRepository>();
services.TryAddScoped<IResourceRepository, ResourceRepository>();
services.TryAddScoped<IReportRepository, ReportRepository>();
services.TryAddScoped<ISellingItemRepository, SellingItemRepository>();
services.TryAddScoped<IStatsAggrRepository, StatsAggrRepository>();
services.TryAddScoped<IStatsDetailRepository, StatsDetailRepository>();
services.TryAddScoped<ITagRepository, TagRepository>();
services.TryAddScoped<ITemplateRepository, TemplateRepository>();
services.TryAddScoped<ITemplateRowRepository, TemplateRowRepository>();
// Servizi Scoped
services.TryAddScoped<IBuyOrderService, BuyOrderService>();
services.TryAddScoped<IConfGlassService, ConfGlassService>();
services.TryAddScoped<IConfProfileService, ConfProfileService>();
services.TryAddScoped<IConfWoodService, ConfWoodService>();
services.TryAddScoped<ICostDriverService, CostDriverService>();
services.TryAddScoped<ICustomerService, CustomerService>();
services.TryAddScoped<IDealerService, DealerService>();
services.TryAddScoped<IEnvirParamService, EnvirParamService>();
services.TryAddScoped<IGenClassService, GenClassService>();
services.TryAddScoped<IGenValService, GenValService>();
services.TryAddScoped<IItemService, ItemService>();
services.TryAddScoped<IItemGroupService, ItemGroupService>();
services.TryAddScoped<IJobStepService, JobStepService>();
services.TryAddScoped<IJobTaskService, JobTaskService>();
services.TryAddScoped<IMatReqService, MatReqService>();
services.TryAddScoped<IOfferService, OfferService>();
services.TryAddScoped<IOfferRowService, OfferRowService>();
services.TryAddScoped<IOrderService, OrderService>();
services.TryAddScoped<IOrderRowService, OrderRowService>();
services.TryAddScoped<IPhaseService, PhaseService>();
services.TryAddScoped<IProductionGroupService, ProductionGroupService>();
services.TryAddScoped<IProductionItemService, ProductionItemService>();
services.TryAddScoped<IProductionBatchService, ProductionBatchService>();
services.TryAddScoped<IProductionOdlService, ProductionOdlService>();
services.TryAddScoped<IProductionPlantService, ProductionPlantService>();
services.TryAddScoped<IResourceService, ResourceService>();
services.TryAddScoped<IReportService, ReportService>();
services.TryAddScoped<ISellingItemService, SellingItemService>();
services.TryAddScoped<IStatsAggrService, StatsAggrService>();
services.TryAddScoped<IStatsDetailService, StatsDetailService>();
services.TryAddScoped<ITagService, TagService>();
services.TryAddScoped<ITemplateService, TemplateService>();
services.TryAddScoped<ITemplateRowService, TemplateRowService>();
// Facade / DataLayerService
services.TryAddScoped<IDataLayerServices, DataLayerServices>();
services.TryAddScoped<ICalcRuidService, CalcRuidService>();
//builder.Services.AddSingleton<DataLayerServices>();
//services.TryAddScoped<IDataLayerServices, DataLayerServices>();
// aggiunta servizi finali Singleton...
services.TryAddSingleton<IImageCacheService, ImageCacheService>();
services.TryAddSingleton<IConfigDataService, ConfigDataService>();
services.TryAddSingleton<ICalcRequestService, CalcRequestService>();
services.TryAddSingleton<IFileService, FileService>();
services.TryAddSingleton<IProdService, ProdService>();
//services.TryAddSingleton<CalcRequestService>();
return services;
}
}
}