using AsbCloudApp.Data; using AsbCloudApp.Services; using AsbCloudDb.Model; using AsbCloudInfrastructure.Services; using AsbCloudInfrastructure.Services.Analysis; using AsbCloudInfrastructure.Services.Cache; using AsbCloudInfrastructure.Services.WellOperationService; 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(options => options.UseNpgsql(configuration.GetConnectionString("DefaultConnection")), ServiceLifetime.Scoped); services.AddScoped(provider => provider.GetService()); services.AddHostedService(); services.AddHostedService(); services.AddSingleton(new CacheDb()); services.AddSingleton(); services.AddSingleton(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); // admin crud services: services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, CrudServiceBase>(); services.AddTransient, DrillParamsService>(); // TelemetryData services services.AddTransient, TelemetryDataSaubService>(); services.AddTransient, TelemetryDataSpinService>(); return services; } } }