Files
parr_api/PARR.AIHIT/AIHIT/SyncherInstaller.cs
2023-08-25 15:32:06 +10:00

38 lines
1.2 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;
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.AddDbContext<AIHITContext>(options =>
options.UseSqlServer(
configuration.GetConnectionString("AihitConnection")
));
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");
//});
}
}
}