PIbd-33_Abazov_A.A._KOP_29/AbazovApp/AccountsApp/Program.cs
2023-11-16 23:49:40 +04:00

41 lines
1.5 KiB
C#

using AccountsBusinessLogic.BusinessLogics;
using AccountsContracts.BusinessLogicContracts;
using AccountsContracts.StorageContracts;
using AccountsDataBaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace AccountsApp
{
internal static class Program
{
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();
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>();
}
}
}