Rogashova_E.A._CourseWork_H.../HospitalView/Program.cs

53 lines
2.3 KiB
C#
Raw Normal View History

using HospitalBusinessLogic.BusinessLogics;
using HospitalContracts.BusinessLogicsContracts;
using HospitalContracts.StoragesContracts;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
namespace HospitalView
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
//services.AddTransient<IIllnessStorage, IllnessStorage>();
//services.AddTransient<ISymptomsStorage, SymptomsStorage>();
//services.AddTransient<IMedicinesStorage, MedicinesStorage>();
//services.AddTransient<IProceduresStorage, ProceduresStorage>();
//services.AddTransient<IRecipesStorage, RecipesStorage>();
//services.AddTransient<IKurseStorage, KurseStorage>();
services.AddTransient<IIllnessLogic, IllnessLogic>();
services.AddTransient<ISymptomsLogic, SymptomsLogic>();
services.AddTransient<IMedicinesLogic, MedicinesLogic>();
services.AddTransient<IProceduresLogic, ProceduresLogic>();
services.AddTransient<IRecipesLogic, RecipesLogic>();
services.AddTransient<IKurseLogic, KurseLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormProcedure>();
services.AddTransient<FormProcedures>();
services.AddTransient<FormMedicine>();
services.AddTransient<FormMedicines>();
//services.AddTransient<FormGiftComponent>();
//services.AddTransient<FormGifts>();
}
}
}