public async Task <IResponse> List(int domain_id, string zonename) { try { using (QueryResult queryResult = await _rqliteService.QueryAsync($"SELECT domain_id,name,type,content,ttl,disabled,auth FROM records WHERE domain_id={domain_id}")) { ListResponse response = ListResponse.FromValues(queryResult.Results.FirstOrDefault().Values); // We need to ask Transaction Manager if we need to hook the lookup query if (_transactionManager.Transactions().Any() && _transactionManager.TransactionExistsWith(domain_id)) { List <IRecord> recordsToDelete = new List <IRecord>(); var transactionRecords = _transactionManager.GetLastTransaction(domain_id).Records; _logger.LogInformation($"Found existing Transaction which handles domain_id {domain_id} => Hooking this query with Transaction Manager"); Parallel.ForEach(transactionRecords, record => { switch (record.TransactionMode) { case Models.PowerDNS.Enums.TransactionMode.DELETE: response.result.RemoveAll(x => x.domain_id == record.domain_id && x.qname == record.qname && x.qtype == record.qtype); break; case Models.PowerDNS.Enums.TransactionMode.INSERT: response.result.Add(record); break; } }); return(response); } else { return(response); } } } catch (NoValuesException) { _logger.LogDebug($"No records found in zone '{zonename}'"); return(new BoolResponse { result = false }); } catch (Exception ex) { _logger.LogError(ex.Message); return(new BoolResponse { Log = new List <string>() { $"Failed to list zone '{zonename}' with domain_id {domain_id}" }, result = false }); } }