62 lines
2.6 KiB
C#
62 lines
2.6 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog.Extensions.Logging;
|
|
using TransportCompanyBusinessLogic.BusinessLogics;
|
|
using TransportCompanyContracts.BusinessLogicsContracts;
|
|
using TransportCompanyContracts.StoragesContracts;
|
|
using TransportCompanyDatabaseImplement.Implements;
|
|
using TransportCompanyView;
|
|
|
|
namespace TransportCompanyView
|
|
{
|
|
internal static class Program
|
|
{
|
|
private static ServiceProvider? _serviceProvider;
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
/// <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();
|
|
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<ICargoStorage, CargoStorage>();
|
|
services.AddTransient<IDriverStorage, DriverStorage>();
|
|
services.AddTransient<IPointStorage, PointStorage>();
|
|
services.AddTransient<ITransportationStorage, TransportationStorage>();
|
|
services.AddTransient<ITransportStorage, TransportStorage>();
|
|
services.AddTransient<ICargoLogic, CargoLogic>();
|
|
services.AddTransient<IDriverLogic, DriverLogic>();
|
|
services.AddTransient<IPointLogic, PointLogic>();
|
|
services.AddTransient<ITransportationLogic, TransportationLogic>();
|
|
services.AddTransient<ITransportLogic, TransportLogic>();
|
|
services.AddTransient<FormCargo>();
|
|
services.AddTransient<FormCargos>();
|
|
services.AddTransient<FormDriver>();
|
|
services.AddTransient<FormDrivers>();
|
|
services.AddTransient<FormPoint>();
|
|
services.AddTransient<FormPoints>();
|
|
services.AddTransient<FormTransport>();
|
|
services.AddTransient<FormTransports>();
|
|
services.AddTransient<FormCreateTransportation>();
|
|
services.AddTransient<FormMain>();
|
|
|
|
}
|
|
}
|
|
} |