public static IServiceCollection AddAspNetCore(this IServiceCollection serviceCollection, Action <AspNetCoreConfig> configureDelegate = null) { var aspNetCoreConfig = new AspNetCoreConfig(); Globals.DefaultConfiguration.Bind(aspNetCoreConfig); configureDelegate?.Invoke(aspNetCoreConfig); serviceCollection.AddSingleton(aspNetCoreConfig); serviceCollection.AddHostedService <AspNetCoreBackgroundService>(); return(serviceCollection); }
public AspNetCoreBackgroundService(AspNetCoreConfig aspNetCoreConfig, StartupHandler startupHandler) { this.aspNetCoreConfig = aspNetCoreConfig; this.startupHandler = startupHandler; }