PIbd-21_MasenkinMS_SUBD_Rou.../RouteGuide/RouteGuideView/Program.cs

87 lines
3.3 KiB
C#
Raw Normal View History

2024-04-05 02:48:52 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using RouteGuideBusinessLogics.BusinessLogics;
using RouteGuideContracts.BusinessLogicsContracts;
using RouteGuideContracts.StoragesContracts;
using RouteGuideDatabaseImplement.Implements;
2024-04-01 00:13:17 +04:00
namespace RouteGuideView
{
internal static class Program
{
2024-04-05 02:48:52 +04:00
/// <summary>
/// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-04-01 00:13:17 +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-05 02:48:52 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
/// <param name="services"></param>
private static void ConfigureServices(ServiceCollection services)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
services.AddTransient<IDriverStorage, DriverStorage>();
services.AddTransient<ITransportStorage, TransportStorage>();
services.AddTransient<IRouteStorage, RouteStorage>();
services.AddTransient<IStopStorage, StopStorage>();
services.AddTransient<IScheduleStorage, ScheduleStorage>();
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
services.AddTransient<IDriverLogic, DriverLogic>();
services.AddTransient<ITransportLogic, TransportLogic>();
services.AddTransient<IRouteLogic, RouteLogic>();
services.AddTransient<IStopLogic, StopLogic>();
services.AddTransient<IScheduleLogic, ScheduleLogic>();
2024-04-09 13:48:30 +04:00
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
2024-04-05 02:48:52 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormSchedule>();
services.AddTransient<FormDriver>();
services.AddTransient<FormDrivers>();
services.AddTransient<FormTransport>();
services.AddTransient<FormTransports>();
services.AddTransient<FormRoute>();
services.AddTransient<FormRoutes>();
services.AddTransient<FormRouteStop>();
services.AddTransient<FormStop>();
services.AddTransient<FormStops>();
2024-04-09 13:48:30 +04:00
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
services.AddTransient<FormSchedulesTests>();
services.AddTransient<FormDriversTests>();
services.AddTransient<FormTransportTests>();
services.AddTransient<FormRoutesTests>();
services.AddTransient<FormStopsTests>();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DateTime Kind=Local <20> <20><>
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
2024-04-01 00:13:17 +04:00
}
}
}