Exemple #1
0
 public DictionaryQueryRunner(IEnumerable <IDictionary <string, object> > source, IEnumerable <SimpleQueryClauseBase> clauses)
 {
     _source          = source;
     _clauses         = clauses.ToList();
     _withCountClause = _clauses.OfType <WithCountClause>().FirstOrDefault();
     if (_withCountClause != null)
     {
         _clauses.Remove(_withCountClause);
     }
 }
 private bool TryApplyWithCountClause(WithCountClause clause)
 {
     IsTotalCountQuery = true;
     SetTotalCount = clause.SetCount;
     return true;
 }
 private bool TryApplyWithCountClause(WithCountClause clause)
 {
     IsTotalCountQuery = true;
     SetTotalCount     = clause.SetCount;
     return(true);
 }
Exemple #4
0
 private bool TryApplyWithCountClause(WithCountClause clause, QueryCommand cmd)
 {
     cmd.SetTotalCount = clause.SetCount;
     return true;
 }
Exemple #5
0
 private bool TryApplyWithCountClause(WithCountClause clause, QueryCommand cmd)
 {
     cmd.SetTotalCount = clause.SetCount;
     return(true);
 }
 private IEnumerable<IDictionary<string, object>> RunQueryWithCount(SimpleQuery query, WithCountClause withCountClause, out IEnumerable<SimpleQueryClauseBase> unhandledClauses)
 {
     var countQuery = query.ClearSkip().ClearTake().Select(new CountSpecialReference());
     var unhandledClausesList = new List<IEnumerable<SimpleQueryClauseBase>>(2);
     using (var enumerator = RunQueries(new[] { countQuery, query }, unhandledClausesList).GetEnumerator())
     {
         unhandledClauses = unhandledClausesList[1];
         if (!enumerator.MoveNext())
         {
             throw new InvalidOperationException();
         }
         var countRow = enumerator.Current.Single();
         withCountClause.SetCount((int) countRow.First().Value);
         if (!enumerator.MoveNext())
         {
             throw new InvalidOperationException();
         }
         return enumerator.Current;
     }
 }