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);
        }
コード例 #2
0
 public AspNetCoreBackgroundService(AspNetCoreConfig aspNetCoreConfig, StartupHandler startupHandler)
 {
     this.aspNetCoreConfig = aspNetCoreConfig;
     this.startupHandler   = startupHandler;
 }