Exemplo n.º 1
0
        public List <string> Handle(GetColumnNamesFromTableQuery query)
        {
            var columns = new List <string>();

            using (var connection = _dbConnectionFactory.Create())
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    _prepareQuery.Handle(query, command, CommandStringTypes.GetColumnNamesFromTable);
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            columns.Add(_readColumn.ReadAsString(CommandStringTypes.GetColumnNamesFromTable, 0, reader));
                        }
                    }
                }
            }
            return(columns);
        }
        /// <inheritdoc />
        public Dictionary <string, int> Handle(GetMessageErrorsQuery <T> query)
        {
            var returnData = new Dictionary <string, int>();

            using (var connection = _connectionFactory.Create())
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    _prepareQuery.Handle(query, command, CommandStringTypes.GetMessageErrors);
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var errorType = _readColumn.ReadAsString(CommandStringTypes.GetMessageErrors, 0, reader).Trim();
                            var count     = _readColumn.ReadAsInt32(CommandStringTypes.GetMessageErrors, 1, reader);
                            returnData.Add(errorType, count);
                        }
                    }
                }
            }

            return(returnData);
        }