PIbd22_NikiforovaMV_Automob.../AutomobilePlant/Program.cs

62 lines
2.5 KiB
C#
Raw Normal View History

2024-04-17 10:13:26 +04:00
using AutomobilePlantBusinessLogic.BusinessLogics;
2024-05-11 13:39:57 +04:00
using AutomobilePlantBusinessLogic.OfficePackage;
using AutomobilePlantBusinessLogic.OfficePackage.Implements;
2024-04-17 10:13:26 +04:00
using AutomobilePlantContracts.BusinessLogicContracts;
using AutomobilePlantContracts.StorageContracts;
2024-05-11 13:35:30 +04:00
using AutomobilePlantDatabaseImplement.Implements;
2024-04-17 10:13:26 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
namespace AutomobilePlant
{
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<ICarStorage, CarStorage>();
2024-06-22 22:23:42 +04:00
services.AddTransient<IClientStorage, ClientStorage>();
2024-04-17 10:17:17 +04:00
2024-04-17 10:13:26 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<ICarLogic, CarLogic>();
2024-05-11 13:39:57 +04:00
services.AddTransient<IReportLogic, ReportLogic>();
2024-06-22 22:23:42 +04:00
services.AddTransient<IClientLogic, ClientLogic>();
2024-05-11 13:39:57 +04:00
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
2024-04-17 10:17:17 +04:00
2024-04-17 10:13:26 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormCar>();
services.AddTransient<FormCarComponent>();
services.AddTransient<FormCars>();
2024-05-11 13:39:57 +04:00
services.AddTransient<FormReportCarComponents>();
services.AddTransient<FormReportOrder>();
2024-06-22 22:23:42 +04:00
services.AddTransient<FormClients>();
2024-04-17 10:13:26 +04:00
}
}
}