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-06-17 15:12:39 +05:00
|
|
|
|
services.AddTransient<IAnalyticsService, AnalyticsService>();
|
2021-07-23 17:40:31 +05:00
|
|
|
|
services.AddTransient<IFileService, FileService>();
|
2021-04-02 17:28:07 +05:00
|
|
|
|
|
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|