diff --git a/InternetShop/InternetShopForms/Program.cs b/InternetShop/InternetShopForms/Program.cs index 6ac242b..cb12ebf 100644 --- a/InternetShop/InternetShopForms/Program.cs +++ b/InternetShop/InternetShopForms/Program.cs @@ -1,7 +1,15 @@ +using InternetShopContracts.LogicsContracts; +using InternetShopContracts.StorageContracts; +using InternetShopDatabase.Storages; +using InternetShopLogics.Logics; +using Microsoft.Extensions.DependencyInjection; + namespace InternetShopForms { internal static class Program { + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; /// /// The main entry point for the application. /// @@ -11,7 +19,20 @@ namespace InternetShopForms // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormOrdersList()); + + var services = new ServiceCollection(); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + + Application.Run(_serviceProvider.GetRequiredService()); + } + private static void ConfigureServices(ServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file