PIbd-31_Rodionov.I.A._COP_28/COP/PortalAccountsView/Program.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2024-10-22 19:42:03 +04:00
using PortalAccountsBusinessLogic.BusinessLogics;
using PortalAccountsContracts.BusinessLogicsContracts;
using PortalAccountsContracts.StoragesContracts;
using PortalAccountsDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
namespace PortalAccountsView
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
[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<IRoleStorage, RoleStorage>();
services.AddTransient<IAccountStorage, AccountStorage>();
services.AddTransient<IRoleLogic, RoleLogic>();
services.AddTransient<IAccountLogic, AccountLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormAccount>();
services.AddTransient<FormRoles>();
}
}
}