PIbd-31_Putincev.D.M._COP_29/COP/PortalAccountsView/Program.cs

40 lines
1.6 KiB
C#
Raw Normal View History

2024-11-19 23:18:49 +04:00
using Microsoft.Extensions.DependencyInjection;
using PortalAccountsBusinessLogic.BusinessLogics;
using PortalAccountsContracts.BusinessLogicsContracts;
using PortalAccountsContracts.StoragesContracts;
using PortalAccountsDatabaseImplement.Implements;
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<IInterestStorage, InterestStorage>();
services.AddTransient<IAccountStorage, AccountStorage>();
services.AddTransient<IInterestLogic, InterestLogic>();
services.AddTransient<IAccountLogic, AccountLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormAccount>();
services.AddTransient<FormInterests>();
}
}
}