コード例 #1
0
        private void OrderBy <TSource, TKey>(Expression <Func <TSource, TKey> > keySelector,
                                             SortOrder sortOrder,
                                             bool thenBy = false)
        {
            if (SkipCount.HasValue)
            {
                throw new NotSupportedException(
                          "Pomona LINQ provider does not support calling Skip() before OrderBy/OrderByDescending");
            }
            if (TakeCount.HasValue)
            {
                throw new NotSupportedException(
                          "Pomona LINQ provider does not support calling Take() before OrderBy/OrderByDescending");
            }

            if (!thenBy)
            {
                OrderKeySelectors.Clear();
            }

            if (SelectExpression != null && GroupByKeySelector == null)
            {
                // Support order by after select (not when using GroupBy)
                OrderKeySelectors.Add(new Tuple <LambdaExpression, SortOrder>(MergeWhereAfterSelect(keySelector),
                                                                              sortOrder));
            }
            else
            {
                OrderKeySelectors.Add(new Tuple <LambdaExpression, SortOrder>(keySelector, sortOrder));
            }
        }
コード例 #2
0
        internal void QGroupBy <TSource, TKey>(Expression <Func <TSource, TKey> > keySelector)
        {
            if (SkipCount.HasValue)
            {
                throw new NotSupportedException("Pomona LINQ provider does not support calling Skip() before GroupBy()");
            }

            if (TakeCount.HasValue)
            {
                throw new NotSupportedException("Pomona LINQ provider does not support calling Take() before GroupBy()");
            }

            if (GroupByKeySelector != null)
            {
                throw new NotSupportedException("Pomona LINQ provider does not support multiple chained GroupBy()");
            }

            if (OrderKeySelectors.Any())
            {
                throw new NotSupportedException("Pomona LINQ provider does not support calling OrderBy before GroupBy()");
            }

            GroupByKeySelector = keySelector;
        }