ISEbd_21_Kuklew_M.I._Softwa.../SoftwareInstallation/Program.cs

60 lines
2.5 KiB
C#
Raw Normal View History

2024-04-07 16:54:02 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-05-12 14:45:39 +04:00
using SoftwareInstallationBusinessLogic.BusinessLogics;
using SoftwareInstallationContracts.BusinessLogicsContracts;
using SoftwareInstallationContracts.StoragesContracts;
using SoftwareInstallationDatabaseImplement.Implements;
using SoftwareInstallationView;
2024-04-07 16:54:02 +04:00
2024-04-07 16:21:01 +04:00
namespace SoftwareInstallation
{
internal static class Program
{
2024-04-07 16:54:02 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-04-07 16:21:01 +04:00
/// <summary>
2024-05-12 14:45:39 +04:00
/// The main entry point for the application.
2024-04-07 16:21:01 +04:00
/// </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();
2024-04-07 16:54:02 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
2024-05-12 14:45:39 +04:00
2024-04-07 16:54:02 +04:00
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
2024-05-12 14:45:39 +04:00
2024-04-07 16:54:02 +04:00
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IPackageStorage, PackageStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
2024-05-12 14:45:39 +04:00
services.AddTransient<FormMain>();
2024-04-07 16:54:02 +04:00
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IPackageLogic, PackageLogic>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormPackage>();
services.AddTransient<FormPackageComponent>();
services.AddTransient<FormPackages>();
2024-05-12 14:45:39 +04:00
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IShopLogic, ShopLogic>();
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormCreateSupply>();
services.AddTransient<FormSellPackage>();
2024-04-07 16:21:01 +04:00
}
}
}