Esempio n. 1
0
        public IReadOnlyList <SqlBuilderResultRow> ToResults(string query, IDictionary <string, object?> parameters)
        {
            var cmd = BuildCommand(query, parameters);

            var results = new List <SqlBuilderResultRow>();

            using (var reader = cmd.ExecuteReader()) {
                while (reader.Read())
                {
                    results.Add(SqlBuilderResultRow.FromReader(reader));
                }
            }
            return(results.AsReadOnly());
        }
Esempio n. 2
0
        public async Task <IReadOnlyList <SqlBuilderResultRow> > ToResultsAsync(
            string query, IDictionary <string, object?> parameters)
        {
            using (_connection) {
                await _connection.OpenAsync();

                var cmd = BuildCommand(query, parameters);

                var results = new List <SqlBuilderResultRow>();
                using (var reader = await cmd.ExecuteReaderAsync()) {
                    while (await reader.ReadAsync())
                    {
                        results.Add(SqlBuilderResultRow.FromReader(reader));
                    }
                }
                return(results.AsReadOnly());
            }
        }