Files
parr_api/PARR.AIHIT/AIHIT/SyncherInstaller.cs

44 lines
1.4 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using PARR.AIHIT.Context;
using PARR.AIHIT.Services;
using PARR.AIHIT.Settings;
using PARR.DAL;
using PARR.Mail;
namespace PARR.AIHIT
{
public static class SyncherInstaller
{
public static void InstallSyncerServices(this IServiceCollection services, IConfiguration configuration)
{
var syncherSettings = new SyncherSettings();
configuration.GetSection(nameof(SyncherSettings)).Bind(syncherSettings);
services.AddSingleton(syncherSettings);
services.InstallMailServices(configuration);
services.InstallDalServices(configuration);
services.AddDbContext<AIHITContext>(options =>
options.UseSqlServer(
configuration.GetConnectionString("AihitConnection")
,sqlServerOptions => sqlServerOptions.CommandTimeout(1800)
));
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
services.AddTransient<ISyncher, Syncher>();
services.AddTransient<IAIHITService,AIHITService>();
//services.AddDbContext <AIHITContext> (options =>
//{
// options.UseSqlServer("server=(10.248.19.97);uid=awhit-ipp-parr;pwd=ET3h$9y1LH#D");
//});
}
}
}