Ejemplo n.º 1
0
 public void Insert(FileModelDb model, string _connectionString)
 {
     using (var connection = new SqlConnection(_connectionString))
     {
         connection.Insert(model);
     }
 }
Ejemplo n.º 2
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            FileModelDb dbModel = new FileModelDb();
            await _messageService.StartReceiveMessagesFromSubscriptionAsync(
                message =>
            {
                _logger.LogInformation("DEVICE: {0}, TEMP: {1}", message.FileName, message.Message);
                dbModel.Filename = message.FileName;
                dbModel.Message  = message.Message;
                //Storage
                _serviceStorage.Insert(dbModel, _connectionString);
            });

            while (!stoppingToken.IsCancellationRequested)
            {
                await Task.Delay(10000, stoppingToken);
            }
        }