PIbd-33_Abazov_A.A._KOP_29/AbazovApp/AccountsApp/Program.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2023-11-16 23:49:40 +04:00
using AccountsBusinessLogic.BusinessLogics;
using AccountsContracts.BusinessLogicContracts;
using AccountsContracts.StorageContracts;
using AccountsDataBaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using System;
2023-11-16 20:39:00 +04:00
namespace AccountsApp
{
internal static class Program
{
2023-11-16 23:49:40 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2023-11-16 20:39:00 +04:00
/// <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();
2023-11-16 23:49:40 +04:00
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>();
2023-11-16 20:39:00 +04:00
}
}
}