PIAPS_CW/WinFormsApp/Program.cs

57 lines
2.2 KiB
C#
Raw Normal View History

using System;
using Microsoft.Extensions.DependencyInjection;
using NLog.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Contracts.StorageContracts;
using DatabaseImplement.Implements;
using Contracts.BusinessLogicContracts;
using BusinessLogic.BusinessLogic;
2024-05-09 17:45:03 +04:00
namespace WinFormsApp
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-05-09 17:45:03 +04:00
/// <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.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<ISupplyStorage, SupplyStorage>();
//services.AddTransient<ISupplyDocStorage, SupplyDocStorage>();
services.AddTransient<IProductStorage, ProductStorage>();
services.AddTransient<ISupplierStorage, SupplierStorage>();
services.AddTransient<ISupplyLogic, SupplyLogic>();
services.AddTransient<ISupplierLogic, SupplierLogic>();
services.AddTransient<IProductLogic, ProductLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormProducts>();
2024-06-23 17:04:26 +04:00
services.AddTransient<FormSuppliers>();
2024-06-23 23:07:41 +04:00
services.AddTransient<FormSupplier>();
2024-06-23 21:35:37 +04:00
services.AddTransient<FormSupply>();
services.AddTransient<FormSupplyProduct>();
2024-06-23 23:07:41 +04:00
services.AddTransient<FormSupplierProduct>();
services.AddTransient<FormMediaFiles>();
2024-06-23 23:07:41 +04:00
2024-05-09 17:45:03 +04:00
}
}
}