コード例 #1
0
        public Worker(ILogger <Worker> logger,
                      IConfiguration configuration)
        {
            _logger = logger;

            _serviceConfigurations = new ServiceConfigurations();
            new ConfigureFromConfigurationOptions <ServiceConfigurations>(
                configuration.GetSection("ServiceConfigurations"))
            .Configure(_serviceConfigurations);
            _serviceConfigurations.Intervalo =
                Convert.ToInt32(configuration["Intervalo"]);

            _jsonOptions = new JsonSerializerOptions()
            {
                IgnoreNullValues = true
            };

            var storageAccount = CloudStorageAccount
                                 .Parse(configuration["BaseMonitoramento"]);

            _monitoramentoTable = storageAccount
                                  .CreateCloudTableClient().GetTableReference("Monitoramento");
            if (_monitoramentoTable.CreateIfNotExistsAsync().Result)
            {
                _logger.LogInformation("Criando a tabela de log...");
            }
        }
コード例 #2
0
        public Worker(ILogger <Worker> logger,
                      IConfiguration configuration)
        {
            _logger = logger;

            _serviceConfigurations = new ServiceConfigurations();
            new ConfigureFromConfigurationOptions <ServiceConfigurations>(
                configuration.GetSection("ServiceConfigurations"))
            .Configure(_serviceConfigurations);

            _jsonOptions = new JsonSerializerOptions()
            {
                IgnoreNullValues = true
            };
        }