/// <summary> Create execution command </summary>
 private CommandInfo CreateCommand(DbRequest request)
 {
     return(new CommandInfo(this, request.CommandText, request.Parameters.ToArray())
     {
         CommandType = request.CommandType,
     });
 }
        /// <summary> Execute command and return data reader </summary>
        private async Task <DataReaderAsync> ExecuteReaderAsync(DbRequest request)
        {
            using (var scope = new QueryExecutionScope(_logger))
            {
                try
                {
                    Command?.Parameters.Clear();
                    CommandTimeout = request.CommandTimeout;

                    return(await CreateCommand(request).ExecuteReaderAsync());
                }
                catch (Exception exception)
                {
                    scope.Log(LogLevel.Error, "DataConnectionBase:Error;", exception);
                    throw;
                }
            }
        }
        /// <summary> Execute command and return typed list of objects </summary>
        private IEnumerable <T> Query <T>(DbRequest request)
        {
            using (var scope = new QueryExecutionScope(_logger))
            {
                try
                {
                    Command?.Parameters.Clear();
                    CommandTimeout = request.CommandTimeout;

                    var command = CreateCommand(request);

                    return(command.Query <T>());
                }
                catch (Exception exception)
                {
                    scope.Log(LogLevel.Error, "DataConnectionBase:Error;", exception);
                    throw;
                }
            }
        }