66 lines
2.7 KiB
C#
Raw Normal View History

2023-03-31 19:55:55 +04:00
using GiftShopBusinessLogic.BusinessLogics;
2023-04-16 21:59:13 +04:00
using GiftShopBusinessLogic.OfficePackage.Implements;
using GiftShopBusinessLogic.OfficePackage;
2023-03-31 19:55:55 +04:00
using GiftShopContracts.BusinessLogicsContracts;
using GiftShopContracts.StoragesContracts;
2023-04-03 08:29:28 +04:00
using GiftShopDatabaseImplement.Implements;
2023-03-31 19:55:55 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2023-03-05 23:33:53 +04:00
namespace GiftShopView
{
internal static class Program
{
2023-03-31 19:55:55 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2023-03-05 23:33:53 +04:00
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2023-03-31 19:55:55 +04:00
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<IGiftStorage, GiftStorage>();
2023-05-14 11:29:13 +04:00
services.AddTransient<IClientStorage, ClientStorage>();
2023-05-14 14:10:25 +04:00
services.AddTransient<IImplementerStorage, ImplementerStorage>();
2023-04-16 21:59:13 +04:00
2023-05-14 14:10:25 +04:00
services.AddTransient<IClientLogic, ClientLogic>();
2023-03-31 19:55:55 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IGiftLogic, GiftLogic>();
2023-04-16 21:59:13 +04:00
services.AddTransient<IReportLogic, ReportLogic>();
2023-05-14 14:10:25 +04:00
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IWorkProcess, WorkModeling>();
2023-04-16 21:59:13 +04:00
2023-05-14 14:10:25 +04:00
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
2023-04-16 21:59:13 +04:00
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
2023-03-31 19:55:55 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormGift>();
services.AddTransient<FormGiftComponent>();
services.AddTransient<FormGifts>();
2023-04-27 23:28:33 +04:00
services.AddTransient<FormReportOrders>();
services.AddTransient<FormReportGiftComponents>();
2023-05-14 11:29:13 +04:00
services.AddTransient<FormClients>();
2023-05-14 14:10:25 +04:00
services.AddTransient<FormImplementer>();
services.AddTransient<FormImplementers>();
}
2023-03-05 23:33:53 +04:00
}
}