2023-10-12 15:21:41 +05:00
|
|
|
|
using System;
|
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Data.Manuals;
|
|
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
2022-04-11 18:00:34 +05:00
|
|
|
|
using AsbCloudApp.Data.SAUB;
|
2022-07-14 03:47:11 +05:00
|
|
|
|
using AsbCloudApp.Data.Subsystems;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudApp.Data.WellOperationImport.Options;
|
2022-10-06 14:37:03 +05:00
|
|
|
|
using AsbCloudApp.Repositories;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudApp.Services;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudApp.Services.AutoGeneratedDailyReports;
|
|
|
|
|
using AsbCloudApp.Services.Notifications;
|
|
|
|
|
using AsbCloudApp.Services.ProcessMaps;
|
2023-10-16 13:45:29 +05:00
|
|
|
|
using AsbCloudApp.Services.ProcessMaps.WellDrilling;
|
2022-08-03 16:35:21 +05:00
|
|
|
|
using AsbCloudApp.Services.Subsystems;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudApp.Services.WellOperationImport;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudDb.Model;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudDb.Model.Manuals;
|
|
|
|
|
using AsbCloudDb.Model.ProcessMaps;
|
2022-07-14 03:47:11 +05:00
|
|
|
|
using AsbCloudDb.Model.Subsystems;
|
2022-12-02 14:48:23 +05:00
|
|
|
|
using AsbCloudInfrastructure.Background;
|
2022-06-16 12:33:05 +05:00
|
|
|
|
using AsbCloudInfrastructure.Repository;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports;
|
2022-04-29 15:39:12 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.DailyReport;
|
2022-04-28 15:04:13 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.DetectOperations;
|
2022-04-11 18:00:34 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.DrillingProgram;
|
2023-10-17 10:20:27 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
|
|
|
|
using AsbCloudInfrastructure.Services.ProcessMaps.WellDrilling;
|
2022-04-11 18:00:34 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.SAUB;
|
2022-08-01 13:55:51 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.Subsystems;
|
2023-02-20 15:57:08 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.Trajectory;
|
2023-10-12 15:21:41 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.WellOperationImport;
|
|
|
|
|
using AsbCloudInfrastructure.Services.WellOperationImport.FileParser;
|
2021-10-09 20:16:22 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.WellOperationService;
|
2022-01-05 17:50:45 +05:00
|
|
|
|
using Mapster;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2022-11-17 16:09:51 +05:00
|
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure
|
|
|
|
|
{
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
2023-10-12 15:21:41 +05:00
|
|
|
|
public static IAsbCloudDbContext MakeContext(string connectionString)
|
|
|
|
|
{
|
|
|
|
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
|
|
|
.UseNpgsql(connectionString)
|
|
|
|
|
.Options;
|
|
|
|
|
var context = new AsbCloudDbContext(options);
|
|
|
|
|
return context;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void MapsterSetup()
|
|
|
|
|
{
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<DateTimeOffset, DateTime>()
|
|
|
|
|
.MapWith((source) => source.DateTime);
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<DateTime, DateTimeOffset>()
|
|
|
|
|
.MapWith((source) => source == default ? new DateTime(0, DateTimeKind.Utc) : source);
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<TimeDto, TimeOnly>()
|
|
|
|
|
.MapWith((source) => source.MakeTimeOnly());
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<TimeOnly, TimeDto>()
|
|
|
|
|
.MapWith((source) => new(source));
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<TimeOnly, TimeDto>()
|
|
|
|
|
.MapWith((source) => new(source));
|
2022-06-06 17:00:53 +05:00
|
|
|
|
|
2023-04-14 10:02:38 +05:00
|
|
|
|
#pragma warning disable CS8603 // Possible null reference return.
|
2023-10-12 15:21:41 +05:00
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<WellDto, Well>()
|
|
|
|
|
.Ignore(dst => dst.Cluster,
|
|
|
|
|
dst => dst.RelationCompaniesWells,
|
|
|
|
|
dst => dst.Telemetry,
|
|
|
|
|
dst => dst.WellComposites,
|
|
|
|
|
dst => dst.WellCompositeSrcs,
|
|
|
|
|
dst => dst.WellOperations,
|
|
|
|
|
dst => dst.WellType);
|
2023-04-14 10:02:38 +05:00
|
|
|
|
#pragma warning restore CS8603 // Possible null reference return.
|
2022-06-06 17:00:53 +05:00
|
|
|
|
|
2023-10-12 15:21:41 +05:00
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<ClusterDto, Cluster>()
|
|
|
|
|
.Ignore(dst => dst.Deposit,
|
|
|
|
|
dst => dst.Wells);
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<FileCategoryDto, FileCategory>();
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<WellFinalDocumentDto, WellFinalDocument>();
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<NotificationDto, Notification>()
|
|
|
|
|
.Ignore(dst => dst.NotificationCategory,
|
|
|
|
|
dst => dst.User);
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<ProcessMapWellDrilling, ProcessMapPlanWellDrillingDto>()
|
|
|
|
|
.Map(dest => dest.AxialLoad, src => new PlanLimitDto
|
|
|
|
|
{
|
|
|
|
|
LimitMax = src.AxialLoadLimitMax,
|
|
|
|
|
Plan = src.AxialLoadPlan
|
|
|
|
|
})
|
|
|
|
|
.Map(dest => dest.Flow, src => new PlanLimitDto
|
|
|
|
|
{
|
|
|
|
|
LimitMax = src.FlowLimitMax,
|
|
|
|
|
Plan = src.FlowPlan
|
|
|
|
|
})
|
|
|
|
|
.Map(dest => dest.Pressure, src => new PlanLimitDto
|
|
|
|
|
{
|
|
|
|
|
LimitMax = src.PressureLimitMax,
|
|
|
|
|
Plan = src.PressurePlan
|
|
|
|
|
})
|
|
|
|
|
.Map(dest => dest.TopDriveSpeed, src => new PlanLimitDto
|
|
|
|
|
{
|
|
|
|
|
LimitMax = src.TopDriveSpeedLimitMax,
|
|
|
|
|
Plan = src.TopDriveSpeedPlan
|
|
|
|
|
})
|
|
|
|
|
.Map(dest => dest.TopDriveTorque, src => new PlanLimitDto
|
|
|
|
|
{
|
|
|
|
|
LimitMax = src.TopDriveTorqueLimitMax,
|
|
|
|
|
Plan = src.TopDriveTorquePlan
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
TypeAdapterConfig.GlobalSettings.Default.Config
|
|
|
|
|
.ForType<ProcessMapPlanWellDrillingDto, ProcessMapWellDrilling>()
|
|
|
|
|
.Map(dest => dest.AxialLoadPlan, src => src.AxialLoad.Plan)
|
|
|
|
|
.Map(dest => dest.AxialLoadLimitMax, src => src.AxialLoad.LimitMax)
|
|
|
|
|
.Map(dest => dest.FlowPlan, src => src.Flow.Plan)
|
|
|
|
|
.Map(dest => dest.FlowLimitMax, src => src.Flow.LimitMax)
|
|
|
|
|
.Map(dest => dest.PressurePlan, src => src.Pressure.Plan)
|
|
|
|
|
.Map(dest => dest.PressureLimitMax, src => src.Pressure.LimitMax)
|
|
|
|
|
.Map(dest => dest.TopDriveSpeedPlan, src => src.TopDriveSpeed.Plan)
|
|
|
|
|
.Map(dest => dest.TopDriveSpeedLimitMax, src => src.TopDriveSpeed.LimitMax)
|
|
|
|
|
.Map(dest => dest.TopDriveTorquePlan, src => src.TopDriveTorque.Plan)
|
|
|
|
|
.Map(dest => dest.TopDriveTorqueLimitMax, src => src.TopDriveTorque.LimitMax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
MapsterSetup();
|
|
|
|
|
string connectionStringName = "DefaultConnection";
|
2022-09-28 14:51:47 +05:00
|
|
|
|
#if DEBUG
|
2023-10-12 15:21:41 +05:00
|
|
|
|
connectionStringName = "DebugConnection";
|
2022-09-28 14:51:47 +05:00
|
|
|
|
#endif
|
2023-10-12 15:21:41 +05:00
|
|
|
|
services.AddDbContext<AsbCloudDbContext>(options =>
|
|
|
|
|
options.UseNpgsql(configuration.GetConnectionString(connectionStringName)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services.AddMemoryCache();
|
|
|
|
|
services.AddScoped<IAsbCloudDbContext>(provider => provider.GetRequiredService<AsbCloudDbContext>());
|
|
|
|
|
|
|
|
|
|
services.AddSingleton(new WitsInfoService());
|
|
|
|
|
services.AddSingleton(provider => TelemetryDataCache<TelemetryDataSaubDto>.GetInstance<TelemetryDataSaub>(provider));
|
|
|
|
|
services.AddSingleton(provider => TelemetryDataCache<TelemetryDataSpinDto>.GetInstance<TelemetryDataSpin>(provider));
|
|
|
|
|
services.AddSingleton<IRequerstTrackerService, RequestTrackerService>();
|
|
|
|
|
services.AddSingleton<BackgroundWorker>();
|
|
|
|
|
services.AddSingleton<NotificationBackgroundWorker>();
|
|
|
|
|
services.AddSingleton<IReduceSamplingService>(provider => ReduceSamplingService.GetInstance(configuration));
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IAuthService, AuthService>();
|
|
|
|
|
services.AddTransient<IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto>, ProcessMapPlanRepository<ProcessMapPlanWellDrillingDto, ProcessMapWellDrilling>>();
|
|
|
|
|
services.AddTransient<IProcessMapPlanRepository<ProcessMapPlanWellReamDto>, ProcessMapPlanRepository<ProcessMapPlanWellReamDto, ProcessMapWellReam>>();
|
|
|
|
|
services.AddTransient<IDepositRepository, DepositRepository>();
|
|
|
|
|
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
|
|
|
|
services.AddTransient<IEventService, EventService>();
|
|
|
|
|
services.AddTransient<FileService>();
|
|
|
|
|
services.AddTransient<IMeasureService, MeasureService>();
|
|
|
|
|
services.AddTransient<IMessageService, MessageService>();
|
|
|
|
|
services.AddTransient<IOperationsStatService, OperationsStatService>();
|
|
|
|
|
services.AddTransient<IReportService, ReportService>();
|
|
|
|
|
services.AddTransient<ISetpointsService, SetpointsService>();
|
|
|
|
|
services.AddTransient<ITelemetryService, TelemetryService>();
|
|
|
|
|
services.AddTransient<ITelemetryUserService, TelemetryUserService>();
|
|
|
|
|
services.AddTransient<ITimezoneService, TimezoneService>();
|
|
|
|
|
services.AddTransient<IWellService, WellService>();
|
|
|
|
|
services.AddTransient<IWellOperationImportService, WellOperationImportService>();
|
2023-10-16 13:45:29 +05:00
|
|
|
|
services.AddTransient<IProcessMapReportWellDrillingExportService, ProcessMapReportWellDrillingExportService>();
|
2023-10-12 15:21:41 +05:00
|
|
|
|
services.AddTransient<IPlannedTrajectoryImportService, PlannedTrajectoryImportService>();
|
|
|
|
|
services.AddTransient<IWellOperationRepository, WellOperationRepository>();
|
|
|
|
|
services.AddTransient<IScheduleReportService, ScheduleReportService>();
|
|
|
|
|
services.AddTransient<IDailyReportService, DailyReportService>();
|
|
|
|
|
services.AddTransient<IDetectedOperationService, DetectedOperationService>();
|
|
|
|
|
services.AddTransient<ISubsystemOperationTimeService, SubsystemOperationTimeService>();
|
|
|
|
|
services.AddTransient<IScheduleRepository, ScheduleRepository>();
|
|
|
|
|
services.AddTransient<IRepositoryWellRelated<OperationValueDto>, CrudWellRelatedRepositoryBase<OperationValueDto, OperationValue>>();
|
|
|
|
|
services.AddTransient<IUserSettingsRepository, UserSettingsRepository>();
|
|
|
|
|
services.AddTransient<IWellFinalDocumentsService, WellFinalDocumentsService>();
|
|
|
|
|
services.AddTransient<IFileCategoryService, FileCategoryService>();
|
|
|
|
|
services.AddTransient<ILimitingParameterService, LimitingParameterService>();
|
2023-10-16 13:45:29 +05:00
|
|
|
|
services.AddTransient<IProcessMapReportWellDrillingService, ProcessMapReportWellDrillingService>();
|
2023-10-17 10:20:27 +05:00
|
|
|
|
services.AddTransient<IProcessMapPlanImportService, ProcessMapPlanImportWellDrillingService>();
|
2023-10-12 15:21:41 +05:00
|
|
|
|
services.AddTransient<WellInfoService>();
|
|
|
|
|
services.AddTransient<IHelpPageService, HelpPageService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<TrajectoryService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IGtrRepository, GtrWitsRepository>();
|
2021-08-24 10:59:10 +05:00
|
|
|
|
|
2023-07-17 11:48:52 +05:00
|
|
|
|
services.AddTransient<NotificationService>();
|
2023-07-10 16:56:55 +05:00
|
|
|
|
services.AddTransient<INotificationRepository, NotificationRepository>();
|
2023-07-13 14:44:40 +05:00
|
|
|
|
services.AddTransient<ICrudRepository<NotificationCategoryDto>, CrudCacheRepositoryBase<NotificationCategoryDto,
|
|
|
|
|
NotificationCategory>>();
|
2023-10-17 11:24:52 +05:00
|
|
|
|
services.AddTransient<IDrillTestRepository, DrillTestRepository>();
|
2023-07-11 19:07:57 +05:00
|
|
|
|
|
2023-10-12 15:21:41 +05:00
|
|
|
|
// admin crud services:
|
|
|
|
|
services.AddTransient<ICrudRepository<TelemetryDto>, CrudCacheRepositoryBase<TelemetryDto, Telemetry>>(s =>
|
|
|
|
|
new CrudCacheRepositoryBase<TelemetryDto, Telemetry>(
|
|
|
|
|
s.GetRequiredService<IAsbCloudDbContext>(),
|
|
|
|
|
s.GetRequiredService<IMemoryCache>(),
|
|
|
|
|
dbSet => dbSet.Include(t => t.Well))); // может быть включен в сервис TelemetryService
|
|
|
|
|
services.AddTransient<ICrudRepository<DepositDto>, CrudCacheRepositoryBase<DepositDto, Deposit>>(s =>
|
|
|
|
|
new CrudCacheRepositoryBase<DepositDto, Deposit>(
|
|
|
|
|
s.GetRequiredService<IAsbCloudDbContext>(),
|
|
|
|
|
s.GetRequiredService<IMemoryCache>(),
|
|
|
|
|
dbSet => dbSet.Include(d => d.Clusters)));
|
|
|
|
|
services.AddTransient<ICrudRepository<CompanyDto>, CrudCacheRepositoryBase<CompanyDto, Company>>(s =>
|
|
|
|
|
new CrudCacheRepositoryBase<CompanyDto, Company>(
|
|
|
|
|
s.GetRequiredService<IAsbCloudDbContext>(),
|
|
|
|
|
s.GetRequiredService<IMemoryCache>(),
|
|
|
|
|
dbSet => dbSet.Include(c => c.CompanyType)));
|
|
|
|
|
|
|
|
|
|
services.AddTransient<ICrudRepository<CompanyTypeDto>, CrudCacheRepositoryBase<CompanyTypeDto, CompanyType>>();
|
|
|
|
|
services.AddTransient<ICrudRepository<ClusterDto>, CrudCacheRepositoryBase<ClusterDto, Cluster>>(s =>
|
|
|
|
|
new CrudCacheRepositoryBase<ClusterDto, Cluster>(
|
|
|
|
|
s.GetRequiredService<IAsbCloudDbContext>(),
|
|
|
|
|
s.GetRequiredService<IMemoryCache>(),
|
|
|
|
|
dbSet => dbSet
|
|
|
|
|
.Include(c => c.Wells)
|
|
|
|
|
.Include(c => c.Deposit))); // может быть включен в сервис ClusterService
|
|
|
|
|
|
|
|
|
|
services.AddTransient<ICrudRepository<DrillerDto>, CrudCacheRepositoryBase<DrillerDto, Driller>>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IHelpPageRepository, HelpPageRepository>();
|
|
|
|
|
services.AddTransient<IFileRepository, FileRepository>();
|
|
|
|
|
services.AddTransient<IFileStorageRepository, FileStorageRepository>();
|
|
|
|
|
services.AddTransient<IWellCompositeRepository, WellCompositeRepository>();
|
|
|
|
|
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
|
|
|
|
|
services.AddTransient<IUserRepository, UserRepository>();
|
|
|
|
|
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
|
|
|
|
services.AddTransient<ITelemetryWirelineRunOutRepository, TelemetryWirelineRunOutRepository>();
|
|
|
|
|
services.AddTransient<IWellFinalDocumentsRepository, WellFinalDocumentsRepository>();
|
|
|
|
|
services.AddTransient<ITrajectoryPlanRepository, TrajectoryPlanRepository>();
|
|
|
|
|
services.AddTransient<ITrajectoryFactRepository, TrajectoryFactRepository>();
|
|
|
|
|
services.AddTransient<IFaqRepository, FaqRepository>();
|
|
|
|
|
services.AddTransient<ISlipsStatService, SlipsStatService>();
|
|
|
|
|
services.AddTransient<IWellContactService, WellContactService>();
|
|
|
|
|
services.AddTransient<ICrudRepository<WellSectionTypeDto>, CrudCacheRepositoryBase<WellSectionTypeDto,
|
|
|
|
|
WellSectionType>>();
|
|
|
|
|
|
|
|
|
|
// Subsystem service
|
|
|
|
|
services.AddTransient<ICrudRepository<SubsystemDto>, CrudCacheRepositoryBase<SubsystemDto, Subsystem>>();
|
|
|
|
|
services.AddTransient<ISubsystemService, SubsystemService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<ICrudRepository<PermissionDto>, CrudCacheRepositoryBase<PermissionDto, Permission>>();
|
|
|
|
|
|
|
|
|
|
// TelemetryData services
|
|
|
|
|
services.AddTransient<ITelemetryDataSaubService, TelemetryDataSaubService>();
|
|
|
|
|
services.AddTransient<ITelemetryDataService<TelemetryDataSpinDto>, TelemetryDataSpinService>();
|
|
|
|
|
|
|
|
|
|
// Wits
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record1Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record1Dto, AsbCloudDb.Model.WITS.Record1>>();
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record7Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record7Dto, AsbCloudDb.Model.WITS.Record7>>();
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record8Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record8Dto, AsbCloudDb.Model.WITS.Record8>>();
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record50Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record50Dto, AsbCloudDb.Model.WITS.Record50>>();
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record60Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record60Dto, AsbCloudDb.Model.WITS.Record60>>();
|
|
|
|
|
services.AddTransient<IWitsRecordRepository<AsbCloudApp.Data.WITS.Record61Dto>, WitsRecordRepository<AsbCloudApp.Data.WITS.Record61Dto, AsbCloudDb.Model.WITS.Record61>>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IAutoGeneratedDailyReportService, AutoGeneratedDailyReportService>();
|
|
|
|
|
services.AddTransient<IAutoGeneratedDailyReportMakerService, AutoGeneratedDailyReportMakerService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IManualDirectoryRepository, ManualDirectoryRepository>();
|
|
|
|
|
services.AddTransient<IManualCatalogService, ManualCatalogService>();
|
|
|
|
|
services.AddTransient<ICrudRepository<ManualDto>, CrudRepositoryBase<ManualDto, Manual>>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IWellboreService, WellboreService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IWellOperationExportService, WellOperationExportService>();
|
|
|
|
|
services.AddTransient<IWellOperationImportService, WellOperationImportService>();
|
|
|
|
|
services.AddTransient<IWellOperationImportTemplateService, WellOperationImportTemplateService>();
|
|
|
|
|
|
|
|
|
|
services.AddTransient<IWellOperationExcelParser<WellOperationImportDefaultOptionsDto>, WellOperationDefaultExcelParser>();
|
|
|
|
|
services.AddTransient<IWellOperationExcelParser<WellOperationImportGazpromKhantosOptionsDto>, WellOperationGazpromKhantosExcelParser>();
|
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddTransientLazy<TService, TImplementation>(this IServiceCollection services)
|
|
|
|
|
where TService : class
|
|
|
|
|
where TImplementation : class, TService
|
|
|
|
|
=> services.AddTransient<TService, TImplementation>()
|
|
|
|
|
.AddTransient(provider => new Lazy<TService>(provider.GetRequiredService<TService>));
|
|
|
|
|
|
|
|
|
|
public static IServiceCollection AddTransientLazy<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory)
|
|
|
|
|
where TService : class
|
|
|
|
|
where TImplementation : class, TService
|
|
|
|
|
=> services.AddTransient<TService, TImplementation>(implementationFactory)
|
|
|
|
|
.AddTransient(provider => new Lazy<TService>(() => implementationFactory(provider)));
|
2021-12-02 11:11:14 +05:00
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|
2023-04-18 16:22:53 +05:00
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
}
|