2024-04-28 02:23:41 +04:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using ServiceStationContracts.BusinessLogicsContracts;
|
|
|
|
using ServiceStationDatabaseImplement.Implements;
|
|
|
|
using NLog.Extensions.Logging;
|
2024-04-28 21:27:37 +04:00
|
|
|
using ServiceStationBusinessLogic.BusinessLogics;
|
|
|
|
using ServiceStationContracts.StoragesContracts;
|
2024-04-28 02:23:41 +04:00
|
|
|
|
|
|
|
|
2024-04-16 20:32:34 +04:00
|
|
|
namespace ServiceStation
|
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
2024-04-28 02:23:41 +04:00
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
2024-04-16 20:32:34 +04:00
|
|
|
/// <summary>
|
|
|
|
/// The main entry point for the application.
|
|
|
|
/// </summary>
|
|
|
|
[STAThread]
|
|
|
|
static void Main()
|
|
|
|
{
|
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-04-28 02:23:41 +04:00
|
|
|
var services = new ServiceCollection();
|
|
|
|
ConfigureServices(services);
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
2024-04-28 21:27:37 +04:00
|
|
|
Application.Run(_serviceProvider.GetRequiredService<Form1>());
|
2024-04-16 20:32:34 +04:00
|
|
|
}
|
2024-04-28 02:23:41 +04:00
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddLogging(option =>
|
|
|
|
{
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
});
|
|
|
|
services.AddTransient<IExecutorStorage, ExecutorStorage>();
|
|
|
|
services.AddTransient<IGuarantorStorage, GuarantorStorage>();
|
2024-04-28 21:27:37 +04:00
|
|
|
services.AddTransient<ICarStorage, CarStorage>();
|
|
|
|
services.AddTransient<IDefectStorage, DefectStorage>();
|
|
|
|
services.AddTransient<IRepairStorage, RepairStorage>();
|
|
|
|
services.AddTransient<ISparePartStorage, SparePartStorage>();
|
|
|
|
services.AddTransient<ITechnicalWorkStorage, TechnicalWorkStorage>();
|
|
|
|
services.AddTransient<IWorkStorage, WorkStorage>();
|
|
|
|
|
|
|
|
services.AddTransient<IExecutorLogic, ExecutorLogic>();
|
|
|
|
services.AddTransient<IGuarantorLogic, GuarantorLogic>();
|
|
|
|
services.AddTransient<ICarLogic, CarLogic>();
|
|
|
|
services.AddTransient<IDefectLogic, DefectLogic>();
|
|
|
|
services.AddTransient<IRepairLogic, RepairLogic>();
|
|
|
|
services.AddTransient<ISparePartLogic, SparePartLogic>();
|
|
|
|
services.AddTransient<ITechnicalWorkLogic, TechnicalWorkLogic>();
|
|
|
|
services.AddTransient<IWorkLogic, WorkLogic>();
|
2024-04-28 02:23:41 +04:00
|
|
|
|
2024-04-28 21:27:37 +04:00
|
|
|
services.AddTransient<Form1>();
|
2024-04-28 02:23:41 +04:00
|
|
|
}
|
2024-04-16 20:32:34 +04:00
|
|
|
}
|
|
|
|
}
|