PIbd-32_Bulatova_K.R._COP_10/COP/WinForms/Program.cs

42 lines
1.5 KiB
C#
Raw Normal View History

2024-10-29 09:22:02 +04:00
using ClientBusinessLogic.BusinessLogics;
using ClientsContracts.BusinessLogicContracts;
using ClientsContracts.StorageContracts;
using ClientsDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace WinForms
{
internal static class Program
{
2024-10-29 09:22:02 +04:00
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();
2024-10-29 09:22:02 +04:00
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>();
}
}
2024-10-29 09:22:02 +04:00
}