Example #1
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .ConfigureServices((hostContext, services) =>
        {
            IConfiguration configuration = hostContext.Configuration;

            WorkerOptions options = configuration.GetSection("WCF").Get <WorkerOptions>();

            services.AddSingleton(options);

            services.AddHostedService <Worker>();
        });
Example #2
0
 public Worker(ILogger <Worker> logger, WorkerOptions options)
 {
     _logger      = logger;
     this.options = options;
 }