55 lines
2.1 KiB
C#
Raw Normal View History

using MedicalDatabaseContracts;
using MedicalDatabaseContracts.Models;
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;
2024-04-24 08:54:15 +04:00
namespace MedicalView
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-04-24 08:54:15 +04:00
/// <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<FormMain>();
services.AddTransient<FormDiagnoses>();
services.AddTransient<FormDoctors>();
services.AddTransient<FormPatients>();
services.AddTransient<FormSpecializations>();
2024-04-24 08:54:15 +04:00
}
}
}