PIbd-21_Ihonkina_E.S._Preca.../PrecastConcretePlant/Program.cs
2023-06-13 12:57:54 +03:00

73 lines
3.2 KiB
C#

using PrecastConcretePlantBusinessLogic.BusinessLogic;
using PrecastConcretePlantBusinessLogic.OfficePackage.Implements;
using PrecastConcretePlantBusinessLogic.OfficePackage;
using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantContracts.StoragesContracts;
using PrecastConcretePlantDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using PrecastConcretePlantBusinessLogic.BusinessLogics;
using PrecastConcretePlantView;
namespace PrecastConcretePlant
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
[STAThread]
static void Main()
{
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<IOrderStorage, OrderStorage>();
services.AddTransient<IReinforcedStorage, ReinforcedStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<IShopLogic, ShopLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormReinforced>();
services.AddTransient<FormReinforcedComponent>();
services.AddTransient<FormReinforceds>();
services.AddTransient<FormReportReinforcedComponents>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormClients>();
services.AddTransient<FormShopReinforced>();
services.AddTransient<FormShops>();
services.AddTransient<FormShop>();
services.AddTransient<FormSellReinforced>();
services.AddTransient<FormReportOrdersByDate>();
services.AddTransient<FormReportShopReinforceds>();
}
}
}