using System; using LibraryContracts.StorageContracts; using LibraryDatabase.Storages; using Microsoft.Extensions.DependencyInjection; namespace LibraryWinFormsApp { 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<FormBooks>()); } private static void ConfigureServices(ServiceCollection services) { services.AddTransient<IAuthorStorage, AuthorStorage>(); services.AddTransient<IBookStorage, BookStorage>(); services.AddTransient<FormBooks>(); services.AddTransient<FormBook>(); services.AddTransient<FormAuthors>(); } } }