PIbd-33_Nevaeva_KA_COP_28/NevaevaLibrary/AccountsView/Program.cs
2023-12-01 01:01:22 +04:00

41 lines
1.5 KiB
C#

using AccountBusinessLogic.BusinessLogic;
using AccountContracts.BusinessLogicsContracts;
using AccountContracts.StoragesContracts;
using AccountDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
namespace AccountsView
{
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>();
}
}
}