/// <summary> /// 配置使用MessageMVC /// </summary> /// <param name="builder">主机生成器</param> /// <param name="registAction">配置注册方法</param> /// <param name="autoDiscovery">自动发现</param> /// <param name="discovery">自定义API发现方法</param> internal static void UseMessageMVC(this IWebHostBuilder builder, Action <IServiceCollection> registAction, bool autoDiscovery, Action discovery) { Console.Write(@"------------------------------------------------------------- ---------------> "); Console.ForegroundColor = ConsoleColor.Green; Console.Write(@"Wecome ZeroTeam MessageMVC"); Console.ResetColor(); Console.WriteLine(@" <---------------- -------------------------------------------------------------"); builder.ConfigureAppConfiguration((ctx, builder) => { DependencyHelper.ServiceCollection.AddSingleton(p => builder); ConfigurationHelper.BindBuilder(builder); ZeroFlowControl.LoadConfig(); ZeroAppOption.Instance.AutoDiscover = autoDiscovery; ZeroAppOption.Instance.Discovery = discovery; ConfigurationHelper.OnConfigurationUpdate = cfg => ctx.Configuration = cfg; ctx.Configuration = ConfigurationHelper.Root; }) .ConfigureServices((ctx, services) => { DependencyHelper.Binding(services); services.AddHostedService <ZeroHostedService>(); registAction(services); ZeroApp.AddDependency(services); }); }