PIbd22_NikiforovaMV_Automob.../AutomobilePlant/Program.cs

50 lines
1.9 KiB
C#
Raw Permalink Normal View History

2024-04-17 10:13:26 +04:00
using AutomobilePlantBusinessLogic.BusinessLogics;
using AutomobilePlantContracts.BusinessLogicContracts;
using AutomobilePlantContracts.StorageContracts;
2024-04-17 10:17:17 +04:00
using AutomobilePlantFileImplement.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-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-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>();
}
}
}