70 lines
3.1 KiB
C#
70 lines
3.1 KiB
C#
using MedicalBusinessLogic.BusinessLogics;
|
|
using MedicalDatabaseContracts;
|
|
using MedicalDatabaseContracts.Models;
|
|
using MedicalDatabaseContracts.SearchModels;
|
|
using MedicalDatabaseContracts.ViewModels;
|
|
using MedicalPostgresqlDatabase.Storages;
|
|
using MedicalView.Diagnoses;
|
|
using MedicalView.Doctors;
|
|
using MedicalView.Patients;
|
|
using MedicalView.Specializations;
|
|
using MedicalView.Visits;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog.Extensions.Logging;
|
|
using System.Text;
|
|
|
|
namespace MedicalView
|
|
{
|
|
internal static class Program
|
|
{
|
|
private static ServiceProvider? _serviceProvider;
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
// see https://aka.ms/applicationconfiguration.
|
|
ApplicationConfiguration.Initialize();
|
|
var services = new ServiceCollection();
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
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<IStorage<Diagnose>, DiagnoseStorage>();
|
|
services.AddTransient<IStorage<Doctor>, DoctorStorage>();
|
|
services.AddTransient<IStorage<Patient>, PatientStorage>();
|
|
services.AddTransient<IStorage<Specialization>, SpecializationStorage>();
|
|
services.AddTransient<IStorage<Visit>, VisitStorage>();
|
|
|
|
services.AddTransient<ILogic<Diagnose, DiagnoseViewModel, DiagnoseSearchModel>, DiagnoseLogic>();
|
|
services.AddTransient<ILogic<Doctor, DoctorViewModel, DoctorSearchModel>, DoctorLogic>();
|
|
services.AddTransient<ILogic<Patient, PatientViewModel, PatientSearchModel>, PatientLogic>();
|
|
services.AddTransient<ILogic<Specialization, SpecializationViewModel, SpecializationSearchModel>, SpecializationLogic>();
|
|
services.AddTransient<ILogic<Visit, VisitViewModel, VisitSearchModel>, VisitLogic>();
|
|
|
|
services.AddTransient<FormMain>();
|
|
services.AddTransient<FormDiagnoses>();
|
|
services.AddTransient<FormDoctors>();
|
|
services.AddTransient<FormPatients>();
|
|
services.AddTransient<FormSpecializations>();
|
|
|
|
services.AddTransient<FormDiagnose>();
|
|
services.AddTransient<FormDoctor>();
|
|
services.AddTransient<FormPatient>();
|
|
services.AddTransient<FormSpecialization>();
|
|
services.AddTransient<FormVisit>();
|
|
}
|
|
}
|
|
} |