55 lines
2.1 KiB
C#
Raw Normal View History

2024-03-30 14:56:54 +04:00
using BarBusinessLogic;
2024-03-30 14:30:43 +04:00
using BarContracts.BusinessLogicsContracts;
using BarContracts.StoragesContracts;
using Microsoft.Extensions.DependencyInjection;
2024-03-30 14:56:54 +04:00
using BarFileImplement.Implements;
2024-03-30 14:30:43 +04:00
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-03-30 14:56:54 +04:00
using BarDataModels;
2024-03-30 14:30:43 +04:00
using BarBusinessLogic.BusinessLogic;
2024-03-30 14:26:33 +04:00
namespace BarView
{
internal static class Program
{
2024-03-30 14:30:43 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-03-30 14:26:33 +04:00
/// <summary>
2024-03-30 14:30:43 +04:00
/// The main entry point for the application.
2024-03-30 14:26:33 +04:00
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
2024-03-30 14:30:43 +04:00
// 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<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<ICocktailStorage, CocktailStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<ICocktailLogic, CocktailLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormCocktail>();
services.AddTransient<FormCocktailComponent>();
services.AddTransient<FormCocktails>();
2024-03-30 14:26:33 +04:00
}
}
}