52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using BusinessLogics.BusinessLogics;
|
|
using Contracts.BusinessLogicContracts;
|
|
using Contracts.StorageContracts;
|
|
using DatabaseImplement.Implements;
|
|
using Forms;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace WinFormsApp1
|
|
{
|
|
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<MainForm>());
|
|
}
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
{
|
|
services.AddLogging(option =>
|
|
{
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
});
|
|
|
|
services.AddTransient<IProductStorage, ProductStorage>();
|
|
services.AddTransient<ICategoryStorage, CategoryStorage>();
|
|
|
|
services.AddTransient<IProductLogic, ProductLogic>();
|
|
services.AddTransient<ICategoryLogic, CategoryLogic>();
|
|
|
|
services.AddTransient<CategoryForm>();
|
|
services.AddTransient<ProductForm>();
|
|
services.AddTransient<MainForm>();
|
|
}
|
|
}
|
|
} |