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

61 lines
2.2 KiB
C#
Raw Normal View History

2024-02-05 20:36:39 +04:00
using ComputersShopBusinessLogic.BusinessLogics;
using ComputersShopContracts.BusinessLogicContracts;
using ComputersShopContracts.StoragesContracts;
2024-02-18 13:58:39 +04:00
using ComputersShopFileImplement.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>();
2024-02-18 12:22:10 +04:00
services.AddTransient<IShopStorage, ShopStorage>();
2024-02-05 20:36:39 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IComputerLogic, ComputerLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
2024-02-18 12:22:10 +04:00
services.AddTransient<IShopLogic, ShopLogic>();
2024-02-05 20:36:39 +04:00
2024-02-18 12:22:10 +04:00
services.AddTransient<FormMain>();
2024-02-05 20:36:39 +04:00
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormComputer>();
services.AddTransient<FormComputers>();
services.AddTransient<FormComputerComponent>();
2024-02-18 12:22:10 +04:00
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormShopReplenishment>();
2024-03-18 20:59:24 +04:00
services.AddTransient<FormSellComputers>();
2024-02-18 12:22:10 +04:00
}
2024-02-05 20:36:39 +04:00
}
}