Esempio n. 1
0
        public async Task <ICollection <string> > GetColumnUniqueValues(string columnName)
        {
            // TODO: This method should be in the query builder.

            if (string.IsNullOrWhiteSpace(columnName))
            {
                throw new ArgumentNullException(columnName);
            }

            var uniqueValues = new List <string>();

            if (!ColumnsInTable.Any(c => c.Name == columnName))
            {
                return(uniqueValues);
            }

            await Connection.EnsureConnected();

            using (var command = Connection.CreateCommand())
            {
                command.CommandText = $"SELECT DISTINCT({columnName}) FROM {TableName}";
                using (var reader = command.ExecuteReader())
                    while (reader.Read())
                    {
                        uniqueValues.Add(reader[0].ToString());
                    }
            }
            return(uniqueValues);
        }
Esempio n. 2
0
 public bool IsQueryable()
 {
     if (!ColumnsInTable.Any())
     {
         return(false);
     }
     if (!ColumnsToGroupBy.Any() && !ColumnsToCount.Any() && !ColumnsToSum.Any())
     {
         return(false);
     }
     return(true);
 }