public SLORMContext Count(params string[] columnNames) { if (columnNames == null) { throw new ArgumentNullException(nameof(columnNames)); } foreach (var currentColumnName in columnNames) { var column = ColumnsInTable.GetFromName(currentColumnName); if (column == null) { continue; } var columnAlreadyInList = ColumnsToCount.GetFromName(column.Name) != null; if (columnAlreadyInList) { continue; } ColumnsToCount.Add(column); } return(this); }
public bool IsQueryable() { if (!ColumnsInTable.Any()) { return(false); } if (!ColumnsToGroupBy.Any() && !ColumnsToCount.Any() && !ColumnsToSum.Any()) { return(false); } return(true); }
public SLORMContext OrderBy(ColumnOrderingRequest orderingRequest) { var column = ColumnsInTable.GetFromName(orderingRequest.ColumnName); if (column == null) { return(this); } var alreadyGroupedByColumn = ColumnsToGroupBy.GetFromName(column.Name) != null || ColumnsToSum.GetFromName(column.Name) != null || ColumnsToCount.GetFromName(column.Name) != null; if (!alreadyGroupedByColumn) { GroupBy(column.Name); } var columnOrdering = new ColumnOrdering(column, orderingRequest); ColumnsToOrderBy.Add(columnOrdering); return(this); }