Ejemplo n.º 1
0
        public IQueryable <TSource> Sort <TSource>(
            IQueryable <TSource> source)
        {
            if (!SortOperations.Any())
            {
                return(source);
            }

            IOrderedQueryable <TSource> sortedSource;

            if (!OrderingMethodFinder.OrderMethodExists(source.Expression))
            {
                sortedSource = source.AddInitialSortOperation(
                    SortOperations.Dequeue());
            }
            else
            {
                sortedSource = (IOrderedQueryable <TSource>)source;
            }

            while (SortOperations.Any())
            {
                sortedSource
                    = sortedSource.AddSortOperation(
                          SortOperations.Dequeue());
            }

            return(sortedSource);
        }
Ejemplo n.º 2
0
        public IQueryable <TSource> Sort <TSource>(
            IQueryable <TSource> source)
        {
            if (!SortOperations.Any())
            {
                return(source);
            }

            IOrderedQueryable <TSource> sortedSource
                = source.AddInitialSortOperation(
                      SortOperations.Dequeue());

            while (SortOperations.Any())
            {
                sortedSource
                    = sortedSource.AddSortOperation(
                          SortOperations.Dequeue());
            }

            return(sortedSource);
        }