PIbd-21_Ihonkina_E.S._Preca.../PrecastConcretePlant/Program.cs

49 lines
2.0 KiB
C#
Raw Permalink Normal View History

2023-02-19 11:27:59 +04:00
using PrecastConcretePlantView;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using PrecastConcretePlantBusinessLogic.BusinessLogic;
using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantContracts.StoragesContracts;
2023-03-18 18:02:16 +04:00
using PrecastConcretePlantFileImplement.Implements;
2023-02-19 11:27:59 +04:00
2023-02-19 11:15:20 +04:00
namespace PrecastConcretePlant
{
internal static class Program
{
2023-02-19 11:27:59 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2023-02-19 11:15:20 +04:00
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2023-02-19 11:27:59 +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<IReinforcedStorage, ReinforcedStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormReinforced>();
services.AddTransient<FormReinforcedComponent>();
services.AddTransient<FormReinforceds>();
2023-02-19 11:15:20 +04:00
}
}
}