Exemple #1
0
        public IConvertible FetchValue(string sql, IEnumerable <KeyValuePair <string, IConvertible> > parameters = null)
        {
            using var scope = _logger.BeginScope("Query {Guid} of type {Type}", Guid.NewGuid(), nameof(FetchValue));

            var enumeratedParameters = parameters?.ToArray() ?? new KeyValuePair <string, IConvertible> [0];

            LogInputParameters(sql, enumeratedParameters);

            var value = _logged.FetchValue(sql, enumeratedParameters);

            _logger.LogDebug("{Value} returned.", value);
            return(value);
        }
Exemple #2
0
        public bool ExecuteOnAdapter(ICommandChannel adapter, string sql, IEnumerable <KeyValuePair <string, IConvertible> > parameters = null)
        {
            var value = adapter.FetchValue(sql, parameters);

            return(Convert.ToBoolean(value));
        }
Exemple #3
0
 private static int GetCount(ICommandChannel adapter)
 {
     return(Convert.ToInt32(adapter.FetchValue("SELECT COUNT(*) FROM test")));
 }
Exemple #4
0
 public IConvertible ExecuteOnAdapter(ICommandChannel adapter, string sql, IEnumerable <KeyValuePair <string, IConvertible> > parameters = null)
 => adapter.FetchValue(sql, parameters);