2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using AsbCloudInfrastructure.Services;
|
2021-10-01 15:44:56 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.Analysis;
|
2021-04-07 18:01:56 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.Cache;
|
2021-10-09 20:16:22 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.WellOperationService;
|
2021-04-02 17:28:07 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure
|
|
|
|
|
{
|
|
|
|
|
public static class DependencyInjection
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
services.AddDbContext<AsbCloudDbContext>(options =>
|
2021-07-16 09:15:10 +05:00
|
|
|
|
options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Scoped);
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
services.AddScoped<IAsbCloudDbContext>(provider => provider.GetService<AsbCloudDbContext>());
|
2021-11-10 14:23:53 +05:00
|
|
|
|
services.AddScoped<IFileShareService, GoogleDriveService>();
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
2021-09-27 11:47:39 +05:00
|
|
|
|
services.AddHostedService<ReportsBackgroundService>();
|
|
|
|
|
services.AddHostedService<TelemetryAnalyticsBackgroundService>();
|
2021-05-19 14:41:27 +05:00
|
|
|
|
|
2021-04-07 18:01:56 +05:00
|
|
|
|
services.AddSingleton(new CacheDb());
|
2021-05-12 16:03:14 +05:00
|
|
|
|
services.AddSingleton<ITelemetryTracker, TelemetryTracker>();
|
2021-09-27 11:47:39 +05:00
|
|
|
|
services.AddSingleton<IReportsBackgroundQueue, ReportsBackgroundQueue>();
|
2021-11-10 14:23:53 +05:00
|
|
|
|
services.AddSingleton<IRequerstTrackerService, RequerstTrackerService>();
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
services.AddTransient<IAuthService, AuthService>();
|
|
|
|
|
services.AddTransient<IWellService, WellService>();
|
2021-07-19 15:31:50 +05:00
|
|
|
|
services.AddTransient<IClusterService, ClusterService>();
|
2021-04-07 18:01:56 +05:00
|
|
|
|
services.AddTransient<ITelemetryService, TelemetryService>();
|
2021-04-23 10:21:25 +05:00
|
|
|
|
services.AddTransient<IMessageService, MessageService>();
|
|
|
|
|
services.AddTransient<IEventService, EventService>();
|
|
|
|
|
services.AddTransient<ITelemetryUserService, TelemetryUserService>();
|
2021-05-18 12:33:23 +05:00
|
|
|
|
services.AddTransient<IReportService, ReportService>();
|
2021-08-13 15:57:22 +05:00
|
|
|
|
services.AddTransient<ITelemetryAnalyticsService, TelemetryAnalyticsService>();
|
2021-07-23 17:40:31 +05:00
|
|
|
|
services.AddTransient<IFileService, FileService>();
|
2021-08-13 17:25:06 +05:00
|
|
|
|
services.AddTransient<IWellOperationService, WellOperationService>();
|
2021-11-22 17:29:19 +05:00
|
|
|
|
services.AddTransient<IOperationsStatService, OperationsStatService>();
|
2021-10-09 20:16:22 +05:00
|
|
|
|
services.AddTransient<IWellOperationImportService, WellOperationImportService>();
|
2021-10-14 12:30:51 +05:00
|
|
|
|
services.AddTransient<IWellCompositeService, WellCompositeService>();
|
2021-08-28 20:00:04 +05:00
|
|
|
|
services.AddTransient<IMeasureService, MeasureService>();
|
2021-08-29 17:25:16 +05:00
|
|
|
|
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
2021-10-11 15:21:26 +05:00
|
|
|
|
services.AddTransient<IDrillParamsService, DrillParamsService>();
|
2021-10-13 17:34:32 +05:00
|
|
|
|
services.AddTransient<IDrillFlowChartService, DrillFlowChartService>();
|
2021-11-22 11:30:08 +05:00
|
|
|
|
services.AddTransient<ITimeZoneService, TimeZoneService>();
|
2021-11-24 16:16:17 +05:00
|
|
|
|
services.AddTransient<ISetpointsService, SetpointsService>();
|
2021-08-24 10:59:10 +05:00
|
|
|
|
|
2021-09-10 11:28:57 +05:00
|
|
|
|
// admin crud services:
|
|
|
|
|
services.AddTransient<ICrudService<DepositDto>, CrudServiceBase<DepositDto, Deposit>>();
|
|
|
|
|
services.AddTransient<ICrudService<ClusterDto>, CrudServiceBase<ClusterDto, Cluster>>();
|
|
|
|
|
services.AddTransient<ICrudService<WellDto>, CrudServiceBase<WellDto, Well>>();
|
|
|
|
|
services.AddTransient<ICrudService<CompanyDto>, CrudServiceBase<CompanyDto, Company>>();
|
|
|
|
|
services.AddTransient<ICrudService<UserDto>, CrudServiceBase<UserDto, User>>();
|
|
|
|
|
services.AddTransient<ICrudService<UserRoleDto>, CrudServiceBase<UserRoleDto, UserRole>>();
|
|
|
|
|
services.AddTransient<ICrudService<TelemetryDto>, CrudServiceBase<TelemetryDto, Telemetry>>();
|
2021-10-11 16:43:10 +05:00
|
|
|
|
services.AddTransient<ICrudService<DrillParamsDto>, DrillParamsService>();
|
2021-09-10 11:28:57 +05:00
|
|
|
|
|
2021-09-17 16:24:01 +05:00
|
|
|
|
// TelemetryData services
|
|
|
|
|
services.AddTransient<ITelemetryDataService<TelemetryDataSaubDto>, TelemetryDataSaubService>();
|
|
|
|
|
services.AddTransient<ITelemetryDataService<TelemetryDataSpinDto>, TelemetryDataSpinService>();
|
|
|
|
|
|
2021-04-02 17:28:07 +05:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|