2021-04-02 17:28:07 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Services;
|
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
|
using AsbCloudInfrastructure.Services;
|
2021-04-07 18:01:56 +05:00
|
|
|
|
using AsbCloudInfrastructure.Services.Cache;
|
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-05-19 14:41:27 +05:00
|
|
|
|
services.AddHostedService<BackgroundWorkerService>();
|
|
|
|
|
|
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-05-19 14:41:27 +05:00
|
|
|
|
services.AddSingleton<IBackgroundQueue, BackgroundQueue>();
|
2021-06-25 15:10:05 +05:00
|
|
|
|
services.AddSingleton<ISaubDataCache, SaubDataCache>();
|
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<IDataService, DataService>();
|
|
|
|
|
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-08-24 16:47:10 +05:00
|
|
|
|
services.AddTransient<IWellOperationsStatService, WellOperationsStatService>();
|
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-09-23 11:37:57 +05:00
|
|
|
|
services.AddTransient<IDrillingProgramApacheService, DrillingProgramApacheService>();
|
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-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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|