55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using ShipyardBusinessLogic.BusinessLogics;
|
|
using ShipyardContracts.BusinessLogicsContracts;
|
|
using ShipyardContracts.StoragesContracts;
|
|
using ShipyardFileImplement.Implements;
|
|
using NLog.Extensions.Logging;
|
|
|
|
namespace ShipyardView
|
|
{
|
|
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()
|
|
{
|
|
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.AddNLog("NLog.config");
|
|
});
|
|
services.AddTransient<IDetailStorage, DetailStorage>();
|
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
|
services.AddTransient<IShipStorage, ShipStorage>();
|
|
services.AddTransient<IDetailLogic, DetailLogic>();
|
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
|
services.AddTransient<IShopStorage, ShopStorage>();
|
|
services.AddTransient<IShipLogic, ShipLogic>();
|
|
services.AddTransient<IShopLogic, ShopLogic>();
|
|
services.AddTransient<FormMain>();
|
|
services.AddTransient<FormDetail>();
|
|
services.AddTransient<FormDetails>();
|
|
services.AddTransient<FormCreateOrder>();
|
|
services.AddTransient<FormShip>();
|
|
services.AddTransient<FormShipDetail>();
|
|
services.AddTransient<FormShips>();
|
|
services.AddTransient<FormShop>();
|
|
services.AddTransient<FormShops>();
|
|
services.AddTransient<FormAddShip>();
|
|
services.AddTransient<FormSellShips>();
|
|
}
|
|
|
|
}
|
|
|
|
} |