ISEbd-22_Kurushina_K.A._Fur.../FurnitureAssembly/Program.cs

49 lines
1.9 KiB
C#
Raw Permalink Normal View History

2023-05-21 20:35:53 +04:00
using FurnitureAssemblyBusinessLogic.BusinessLogic;
using FurnitureAssemblyContracts.BusinessLogicsContracts;
using FurnitureAssemblyContracts.StoragesContracts;
using FurnitureAssemblyListImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
2023-05-21 19:46:50 +04:00
namespace FurnitureAssembly
{
internal static class Program
{
2023-05-21 20:35:53 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2023-05-21 19:46:50 +04:00
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2023-05-21 20:35:53 +04:00
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<IOrderStorage, OrderStorage>();
services.AddTransient<IProductStorage, ProductStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IProductLogic, ProductLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormProduct>();
services.AddTransient<FormProductComponent>();
services.AddTransient<FormProducts>();
2023-05-21 19:46:50 +04:00
}
}
}