SUBD_Aleikin/Restaurant/RestaurantView/Program.cs

58 lines
2.5 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using RestaurantBusinessLogic.BusinessLogics;
using RestaurantContracts.BusinessLogicsContracts;
using RestaurantContracts.StoragesContracts;
using RestaurantDatabaseImplement.Implements;
using System;
namespace RestaurantView
{
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.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IProductStorage, ProductStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IProviderStorage, ProviderStorage>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IProductLogic, ProductLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IProviderLogic, ProviderLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormClients>();
services.AddTransient<FormClient>();
services.AddTransient<FormProvider>();
services.AddTransient<FormProviders>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormComponentProvider>();
services.AddTransient<FormProduct>();
services.AddTransient<FormProducts>();
services.AddTransient<FormProductComponent>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormOrderProduct>();
}
}
}