public Worker(ILogger <Worker> logger, WorkerOptions options) { _logger = logger; _options = options; _monitorList = new List <FolderMonitor>(); _configMonitor = new ConfigMonitor(_options.ConfigPath); _configMonitor.FileChanged += FileChangedCallback; }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { IConfiguration configuration = hostContext.Configuration; WorkerOptions options = configuration.GetSection("DT").Get <WorkerOptions>(); services.AddSingleton(options); services.AddHostedService <Worker>(); });