using System.Reflection; using HZY.Framework.DependencyInjection; using Microsoft.Extensions.DependencyInjection; namespace Scada { internal static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { var services = new ServiceCollection(); ConfigureServices(services); ApplicationConfiguration.Initialize(); var serviceProvider = services.BuildServiceProvider(); Globals.ServiceProvider = serviceProvider; var frmMain = serviceProvider.GetRequiredService(); Application.Run(frmMain); } private static void ConfigureServices(ServiceCollection services) { services.AddDependencyInjection(options => { options.Assemblies = new[] { typeof(Program).Assembly }; }); } } }