42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using PARR.AIHITLoader.Context;
|
|
using PARR.AIHITLoader.Services;
|
|
using PARR.AIHITLoader.Settings;
|
|
using PARR.BLL;
|
|
|
|
namespace PARR.AIHITLoader
|
|
{
|
|
public static class AihitLoaderInstaller
|
|
{
|
|
public static void InstallAihitLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.InstallBllServices(configuration);
|
|
|
|
var settings = new WorkerSettings();
|
|
configuration.GetSection(nameof(WorkerSettings)).Bind(settings);
|
|
services.AddSingleton(settings);
|
|
|
|
var loaderSettings = new LoaderSettings();
|
|
configuration.GetSection(nameof(LoaderSettings)).Bind(loaderSettings);
|
|
services.AddSingleton(loaderSettings);
|
|
|
|
var mqSettings = new MqSettings();
|
|
configuration.GetSection(nameof(MqSettings)).Bind(mqSettings);
|
|
services.AddSingleton(mqSettings);
|
|
|
|
services.AddDbContext<AIHITContext>(options =>
|
|
options.UseSqlServer(
|
|
configuration.GetConnectionString("AihitConnection")
|
|
, sqlServerOptions => sqlServerOptions.CommandTimeout(1800)
|
|
));
|
|
|
|
services.AddTransient<IAihitLoader, AihitLoader>();
|
|
services.AddTransient<IAIHITService, AIHITService>();
|
|
|
|
//todo: config e.t.c
|
|
}
|
|
}
|
|
}
|