Beispiel #1
0
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            var injectorConfiguration = new InjectorConfiguration();

            try { Console.Title = Title; } catch (PlatformNotSupportedException) { }
            var configuration = ConfiguratorBuilder.InitializeConfiguration(args, new[] { "injector.yml", "logger.yml" });

            LogLanguage.Language = injectorConfiguration.Language;

            return(Host.CreateDefaultBuilder(args)
                   .ConfigureLogging(
                       loggingBuilder =>
            {
                loggingBuilder.ClearProviders();
                loggingBuilder.AddSerilog(dispose: true);
            }
                       )
                   .ConfigureServices((hostContext, services) =>
            {
                services.AddOptions <InjectorConfiguration>().Bind(configuration);
                services.AddHostedService <Worker>();
            }));
        }
Beispiel #2
0
 public Worker(IOptions <InjectorConfiguration> configuration, ILogger <Worker> logger)
 {
     _configuration = configuration.Value;
     _logger        = logger;
 }