public static IHostBuilder UseMicronetes(this IHostBuilder builder) { return(builder.ConfigureServices(services => services.AddMicronetes())); }
public static MultipleServerHostBuilder AsMultipleServerHostBuilder(this IHostBuilder hostBulder) { return(new MultipleServerHostBuilder(hostBulder)); }
public static ISuperSocketHostBuilder <TReceivePackage> AsSuperSocketHostBuilder <TReceivePackage, TPipelineFilter>(this IHostBuilder hostBuilder) where TPipelineFilter : IPipelineFilter <TReceivePackage>, new() { if (hostBuilder is ISuperSocketHostBuilder <TReceivePackage> ssHostBuilder) { return(ssHostBuilder); } return((new SuperSocketHostBuilder <TReceivePackage>(hostBuilder)) .UsePipelineFilter <TPipelineFilter>()); }
public void ConfigureHost(IHostBuilder host) { }
/// <summary> /// Add a <see cref="DbContext"/> and configure them in the next constructing pipeline. /// </summary> /// <typeparam name="TContext">The required <see cref="DbContext"/>.</typeparam> /// <param name="builder">The <see cref="IHostBuilder"/></param> /// <param name="configures">The configure delegate</param> /// <returns>The <see cref="IHostBuilder"/></returns> public static IHostBuilder AddDatabase <TContext>(this IHostBuilder builder, Action <DbContextOptionsBuilder> configures) where TContext : DbContext { return(builder.AddDatabase <TContext>((_, b) => configures(b))); }
public static IHostBuilder ConfigureDiscordBot( this IHostBuilder hostBuilder, Action <IBotApplicationBuilder> configure = null) { return(ConfigureDiscordBot(hostBuilder, true, configure)); }
public static Task RunAsServiceAsync(this IHostBuilder hostBuilder, CancellationToken cancellationToken = default) { return(hostBuilder.UseServiceBaseLifetime().Build().RunAsync(cancellationToken)); }
public WorkerHostBuilder(IHostBuilder hostBuilder) { this.HostBuilder = hostBuilder; }
public static IHostBuilder ConfigureDefaultTestWebScriptHost(this IHostBuilder builder, Action <ScriptApplicationHostOptions> configure = null, bool runStartupHostedServices = false) { return(builder.ConfigureDefaultTestWebScriptHost(null, configure, runStartupHostedServices)); }
/// <summary> /// Use this override to customize the services registered with the IHostBuilder. /// /// It is recommended not to call ConfigureWebHostDefaults to configure the IWebHostBuilder inside this method. /// Instead customize the IWebHostBuilder in the Init(IWebHostBuilder) overload. /// </summary> /// <param name="builder"></param> protected override void Init(IHostBuilder builder) { }
protected override IHost CreateHost(IHostBuilder builder) { builder.UseServiceProviderFactory(new CustomServiceProviderFactory()); return(base.CreateHost(builder)); }
protected override IHost CreateHost(IHostBuilder builder) => _createHost(builder);
public static void ConfigureHost(IHostBuilder builder) => builder .ConfigureAppConfiguration(builder => builder.AddConfiguration(Configuration.Base)) .UseSerilog();
public static IHostBuilder ConfigureDefaultTestHost(this IHostBuilder builder, params Type[] types) { return(builder.ConfigureDefaultTestHost(b => { }, types)); }
/// <inheritdoc/> protected override IHost CreateHost(IHostBuilder builder) { builder.UseAutofac(); return(base.CreateHost(builder)); }
/// <summary> /// Listens for Unity.Application.quit <see cref="UnityEngine.Application"/> to start the shutdown process. /// This will unblock extensions like RunAsync and WaitForShutdownAsync. /// </summary> /// <param name="hostBuilder">The <see cref="IHostBuilder" /> to configure.</param> /// <param name="configureOptions">The delegate for configuring the <see cref="UnityLifetime"/>.</param> /// <returns>The same instance of the <see cref="IHostBuilder"/> for chaining.</returns> public static IHostBuilder UseUnityLifetime(this IHostBuilder hostBuilder, Action <UnityLifeTimeOptions> configureOptions) => hostBuilder.ConfigureServices((context, collection) => { collection.AddSingleton <IHostLifetime, UnityLifetime>(); collection.Configure(configureOptions); });
internal static bool IsDiscordBotConfigures(this IHostBuilder hostBuilder) { return(hostBuilder.Properties.TryGetValue(DiscordBotProperty, out var value) && Equals(value, true)); }
/// <summary> /// Listens for Unity.Application.quit <see cref="UnityEngine.Application"/> to start the shutdown process. /// This will unblock extensions like RunAsync and WaitForShutdownAsync. /// </summary> /// <param name="hostBuilder">The <see cref="IHostBuilder" /> to configure.</param> /// <returns>The same instance of the <see cref="IHostBuilder"/> for chaining.</returns> public static IHostBuilder UseUnityLifetime(this IHostBuilder hostBuilder) => hostBuilder.ConfigureServices((context, collection) => collection.AddSingleton <IHostLifetime, UnityLifetime>());
/// <summary> /// 泛型主机注入 /// </summary> /// <param name="hostBuilder">泛型主机注入构建器</param> /// <param name="autoRegisterBackgroundService">是否自动注册 BackgroundService</param> /// <returns>IWebHostBuilder</returns> public static IHostBuilder Inject(this IHostBuilder hostBuilder, bool autoRegisterBackgroundService = true) { InternalApp.ConfigureApplication(hostBuilder, autoRegisterBackgroundService); return(hostBuilder); }
internal static IHostBuilder ConfigureModules(this IHostBuilder builder) => builder.ConfigureAppConfiguration((ctx, cfg) =>
public static IHostBuilder UseServiceBaseLifetime(this IHostBuilder hostBuilder) { return(hostBuilder.ConfigureServices((hostContext, services) => services.AddSingleton <IHostLifetime, ServiceBaseLifetime>())); }
/// <summary> /// Configure Configuration with embedded appsettings.json /// </summary> /// <param name="builder"></param> /// <param name="args"></param> /// <returns></returns> public static IHostBuilder ConfigureEmbeddedConfiguration(this IHostBuilder builder, string[] args) => ConfigureEmbeddedConfiguration(builder, args, Assembly.GetEntryAssembly(), AppContext.BaseDirectory);
public static void Main(string[] args) { IHostBuilder builder = CreateHostBuilder(args); builder.Build().Run(); }
public static IHostBuilder AddWordsAPIClient(this IHostBuilder hostBuilder, Action <WordsAPIOptions> configureOptions = null) => hostBuilder.ConfigureServices(s => s.AddWordsAPIClient(ob => ob.Configure(configureOptions)));
XafApplication IDesignTimeApplicationFactory.Create() { IHostBuilder hostBuilder = CreateHostBuilder(Array.Empty <string>()); return(DesignTimeApplicationFactoryHelper.Create(hostBuilder)); }
/// <summary> /// Must be call after Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults() /// </summary> /// <param name="builder"></param> /// <returns></returns> public static IHostBuilder ConfigureSilkierQuartzHost(this IHostBuilder builder) { _quartzHostedServiceIsAdded = true; return(builder.ConfigureServices(services => services.AddHostedService <QuartzHostedService>())); }
public static ISuperSocketHostBuilder <TReceivePackage> AsSuperSocketHostBuilder <TReceivePackage>(this IHostBuilder hostBuilder) { if (hostBuilder is ISuperSocketHostBuilder <TReceivePackage> ssHostBuilder) { return(ssHostBuilder); } return(new SuperSocketHostBuilder <TReceivePackage>(hostBuilder)); }
public static IHostBuilder ConfigureQuartzHost(this IHostBuilder builder) => builder.ConfigureSilkierQuartzHost();
public static IServer BuildAsServer(this IHostBuilder hostBuilder) { var host = hostBuilder.Build(); return(host.AsServer()); }
public static IHostBuilder ConfigureCooperLogging(this IHostBuilder builder, string applicationName) => builder.ConfigureLogging((ctx, logging) =>