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

54 lines
2.2 KiB
C#
Raw 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>();
2023-04-21 04:43:43 +04:00
services.AddTransient<IShopStorage, ShopStorage>();
2023-02-19 11:27:59 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
2023-04-21 04:43:43 +04:00
services.AddTransient<IShopLogic, ShopLogic>();
2023-02-19 11:27:59 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormReinforced>();
services.AddTransient<FormReinforcedComponent>();
services.AddTransient<FormReinforceds>();
2023-04-21 04:43:43 +04:00
services.AddTransient<FormShopReinforced>();
services.AddTransient<FormShops>();
services.AddTransient<FormShop>();
2023-02-19 11:15:20 +04:00
}
}
}