PIbd-23_Firsov_KA_SUBD/Hotel/HotelView/Program.cs

47 lines
1.8 KiB
C#
Raw Permalink Normal View History

2024-05-29 14:28:53 +04:00
using static System.Windows.Forms.DataFormats;
using System;
using Microsoft.Extensions.DependencyInjection;
using HotelAbstractions.Logic;
using HotelDatabase.Implement;
namespace HotelView
{
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<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddTransient<IHotelLogic, HotelImplement>();
services.AddTransient<IRoomLogic, RoomImplement>();
services.AddTransient<IReservationLogic, ReservationImplement>();
services.AddTransient<IGuestLogic, GuestImplement>();
services.AddTransient<IServiceCheckLogic, ServiceCheckImplement>();
services.AddTransient<IServiceLogic, ServiceImplement>();
services.AddTransient<FormMain>();
services.AddTransient<FormHotel>();
services.AddTransient<FormGuest>();
services.AddTransient<FormService>();
services.AddTransient<FormReservation>();
services.AddTransient<FormServiceCheck>();
services.AddTransient<FormRoom>();
}
}
}