PIbd-23-Nasyrov-A.G.-Flower.../ProjectFlowerShop/Program.cs

63 lines
2.5 KiB
C#

using FlowerShopBusinessLogic.BusinessLogic;
using FlowerShopContracts.BusinessLogicsContracts;
using FlowerShopContracts.StoragesContracts;
using FlowerShopDatabaseImplement.Implements;
using ProjectFlowerShop;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using System.Drawing;
using FlowerShopBusinessLogic;
using FlowerShopBusinessLogic.OfficePackage.Implements;
using FlowerShopBusinessLogic.OfficePackage;
namespace ProjectFlowerShop
{
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<MainForm>());
}
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<IFlowerStorage, FlowerStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IFlowerLogic, FlowerLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<MainForm>();
services.AddTransient<ComponentForm>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormFlower>();
services.AddTransient<FormFlowerComponent>();
services.AddTransient<FormFlowers>();
services.AddTransient<FormReportFlowerComponent>();
services.AddTransient<FormReportOrders>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
}
}
}