66 lines
2.4 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using TransportCompanyBusinessLogic.BusinessLogic;
using TransportCompanyContracts.BusinessLogicsContracts;
using TransportCompanyContracts.StoragesContracts;
using TransportCompanyDatabaseImplements.Implements;
namespace TransportCompany
{
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<FormTrucking>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<ICargoStorage, CargoStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<ITransportStorage, TransportStorage>();
services.AddTransient<ITransportationStorage, TransportationStorage>();
services.AddTransient<ITruckingStorage, TruckingStorage>();
services.AddTransient<ICargoLogic, CargoLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<ITransportLogic, TransportLogic>();
services.AddTransient<ITransportationLogic, TransportationLogic>();
services.AddTransient<ITruckingLogic, TruckingLogic>();
services.AddTransient<FormTrucking>();
services.AddTransient<FormCargo>();
services.AddTransient<FormClients>();
services.AddTransient<FormTransport>();
services.AddTransient<FormTypeTransportation>();
services.AddTransient<FormCreateCargo>();
services.AddTransient<FormCreateClient>();
services.AddTransient<FormCreateTrucking>();
services.AddTransient<FormCreateTransport>();
services.AddTransient<FormCreateTypeTransportation>();
services.AddTransient<FormRandomCreateClient>();
services.AddTransient<FormRandomCreateTrucking>();
}
}
}