PIbd-32_Bulatova_K.R._COP_10/COP/WinForms/Program.cs
2024-10-29 09:22:02 +04:00

42 lines
1.5 KiB
C#

using ClientBusinessLogic.BusinessLogics;
using ClientsContracts.BusinessLogicContracts;
using ClientsContracts.StorageContracts;
using ClientsDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace WinForms
{
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();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddTransient<IStatusStorage, StatusStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IStatusLogic, StatusLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormClient>();
services.AddTransient<FormStatus>();
}
}
}