PIbd-21_Putincev_D.M._SUBD/Booking/BookingView/Program.cs

43 lines
1.7 KiB
C#

using BookingAbstractions.WorkAbstractions;
using BookingPostgresImplementation.WorkImplementation;
using Microsoft.Extensions.DependencyInjection;
namespace BookingView
{
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<IPublisherWork, PublisherWork>();
services.AddTransient<IAuthorWork, AuthorWork>();
services.AddTransient<IClientWork, ClientWork>();
services.AddTransient<IReviewWork, ReviewWork>();
services.AddTransient<IBookingWork, BookingWork>();
services.AddTransient<IBookWork, BookWork>();
services.AddTransient<FormMain>();
services.AddTransient<FormPublisher>();
services.AddTransient<FormAuthor>();
services.AddTransient<FormClient>();
services.AddTransient<FormReview>();
services.AddTransient<FormBooking>();
services.AddTransient<FormBook>();
}
}
}