PIbd-23-Volkov-N.A.-Compute.../ComputersShop/ComputersShopView/Program.cs

55 lines
1.8 KiB
C#
Raw Permalink Normal View History

2024-02-05 20:36:39 +04:00
using ComputersShopBusinessLogic.BusinessLogics;
using ComputersShopContracts.BusinessLogicContracts;
using ComputersShopContracts.StoragesContracts;
2024-03-04 22:33:22 +04:00
using ComputersShopDataBaseImplement.Implements;
2024-02-05 20:36:39 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-02-18 13:58:39 +04:00
2024-02-05 20:36:39 +04:00
namespace ComputersShopView
{
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.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IComputerStorage, ComputerStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IComputerLogic, ComputerLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormComputer>();
services.AddTransient<FormComputers>();
services.AddTransient<FormComputerComponent>();
}
}
}