53 lines
2.2 KiB
C#

using HotelBusinessLogic.BusinessLogics;
using HotelContracts.BusinessLogicsContracts;
using HotelContracts.StoragesContracts;
using Microsoft.Extensions.DependencyInjection;
using HotelDatabaseImplement.Implements;
using System;
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<IBookingStorage, BookingStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IPostStorage, PostStorage>();
services.AddTransient<IRoomStorage, RoomStorage>();
services.AddTransient<IWorkerStorage, WorkerStorage>();
services.AddTransient<IBookingLogic, BookingLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IPostLogic, PostLogic>();
services.AddTransient<IRoomLogic, RoomLogic>();
services.AddTransient<IWorkerLogic, WorkerLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormClients>();
services.AddTransient<FormClient>();
services.AddTransient<FormPosts>();
services.AddTransient<FormPost>();
services.AddTransient<FormWorker>();
services.AddTransient<FormWorkers>();
services.AddTransient<FormRooms>();
services.AddTransient<FormRoom>();
services.AddTransient<FormBooking>();
}
}
}