PIbd-22_Shabunov_O.A._AutoW.../AutoWorkshopView/Program.cs

53 lines
1.9 KiB
C#
Raw Normal View History

2024-02-21 11:04:46 +04:00
using AutoWorkshopBusinessLogic.BusinessLogics;
2024-02-21 10:36:30 +04:00
using AutoWorkshopContracts.BusinessLogicContracts;
using AutoWorkshopContracts.StoragesContracts;
2024-02-21 11:04:46 +04:00
using AutoWorkshopListImplement.Implements;
2024-02-21 10:36:30 +04:00
using AutoWorkshopView.Forms;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
2024-02-21 11:04:46 +04:00
using NLog.Extensions.Logging;
2024-02-21 10:36:30 +04:00
2024-02-20 23:51:24 +04:00
namespace AutoWorkshopView
2024-02-06 22:59:42 +04:00
{
internal static class Program
{
2024-02-21 10:36:30 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-02-06 22:59:42 +04:00
[STAThread]
static void Main()
{
2024-02-21 11:04:46 +04:00
ApplicationConfiguration.Initialize();
2024-02-21 10:36:30 +04:00
var Services = new ServiceCollection();
ConfigureServices(Services);
2024-02-21 11:04:46 +04:00
_serviceProvider = Services.BuildServiceProvider();
2024-02-21 10:36:30 +04:00
Application.Run(_serviceProvider.GetRequiredService<MainForm>());
}
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>();
2024-02-21 11:04:46 +04:00
Services.AddTransient<IRepairStorage, RepairStorage>();
2024-02-21 10:36:30 +04:00
Services.AddTransient<IComponentLogic, ComponentLogic>();
Services.AddTransient<IOrderLogic, OrderLogic>();
2024-02-21 11:04:46 +04:00
Services.AddTransient<IRepairLogic, RepairLogic>();
2024-02-21 10:36:30 +04:00
Services.AddTransient<MainForm>();
2024-02-21 11:04:46 +04:00
Services.AddTransient<FormComponent>();
Services.AddTransient<FormComponents>();
Services.AddTransient<FormCreateOrder>();
Services.AddTransient<FormRepair>();
Services.AddTransient<FormRepairComponent>();
Services.AddTransient<FormRepairs>();
2024-02-06 22:59:42 +04:00
}
}
2024-02-20 23:51:24 +04:00
}