74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
|
|
using BusinessBL.BusinessBL;
|
|
using BusinessLogic.BusinessLogic;
|
|
using Contracts.BusinessLogic;
|
|
using Contracts.Storage;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using MongoDB;
|
|
using NLog.Extensions.Logging;
|
|
using System;
|
|
|
|
namespace Forms
|
|
{
|
|
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<IStatusStorage, StatusStorage>();
|
|
services.AddTransient<IHumanStorage, HumanStorage>();
|
|
services.AddTransient<ICarStorage, CarStorage>();
|
|
services.AddTransient<ICompanyStorage,CompanyStorage>();
|
|
services.AddTransient<IVoyageStorage, VoyageStorage>();
|
|
services.AddTransient<IPlaceStorage, PlaceStorage>();
|
|
services.AddTransient<IRouteStorage, RouteStorage>();
|
|
|
|
|
|
services.AddTransient<IStatusLogic, StatusBL>();
|
|
services.AddTransient<IHumanLogic, HumanBL>();
|
|
services.AddTransient<ICarLogic, CarBL>();
|
|
services.AddTransient<ICompanyLogic, CompanyBL>();
|
|
services.AddTransient<IVoyageLogic, VoyageBL>();
|
|
services.AddTransient<IPlaceLogic, PlaceBL>();
|
|
services.AddTransient<IRouteLogic, RouteBL>();
|
|
|
|
services.AddTransient<FormMain>();
|
|
services.AddTransient<FormCars>();
|
|
services.AddTransient<FormCar>();
|
|
services.AddTransient<FormHumans>();
|
|
services.AddTransient<FormHuman>();
|
|
services.AddTransient<FormCompanies>();
|
|
services.AddTransient<FormCompany>();
|
|
services.AddTransient<FormStatuses>();
|
|
services.AddTransient<FormStatus>();
|
|
services.AddTransient<FormPlaces>();
|
|
services.AddTransient<FormPlace>();
|
|
services.AddTransient<FormRoutes>();
|
|
services.AddTransient<FormRoute>();
|
|
services.AddTransient<FormVoyage>();
|
|
services.AddTransient<FormReportHumans>();
|
|
services.AddTransient<FormReportCompanies>();
|
|
}
|
|
}
|
|
} |