PIbd-21_Afanasev_S.S_SUBD_C.../ComputerFirm/Forms/Program.cs

36 lines
1.4 KiB
C#
Raw Normal View History

2024-05-06 22:17:29 +04:00
using database;
using Microsoft.Extensions.DependencyInjection;
2024-05-06 22:14:08 +04:00
namespace Forms
{
internal static class Program
{
2024-05-06 22:17:29 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-05-06 22:14:08 +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();
2024-05-06 22:17:29 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddTransient<Abstractions, Implementation>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormDevice>();
services.AddTransient<FormService>();
services.AddTransient<FormClient>();
services.AddTransient<FormOrder>();
services.AddTransient<FormEmployees>();
2024-05-06 22:14:08 +04:00
}
}
}