示例#1
0
 public static IQueryable <T> ThenBy <T>(this IQueryable <T> source, PropertySortCondition condition)
 {
     if (condition == null)
     {
         throw new ArgumentNullException("condition");
     }
     return(QuerySortHelper <T> .ThenBy(source, condition.PropertyName, condition.ListSortDirection));
 }
示例#2
0
        public static IQueryable <T> ThenBy <T>(this IQueryable <T> source, string propertyName, ListSortDirection listSortDirection)
        {
            if (string.IsNullOrWhiteSpace(propertyName))
            {
                throw new ArgumentNullException("propertyName");
            }

            return(QuerySortHelper <T> .ThenBy(source, propertyName, listSortDirection));
        }
示例#3
0
        public static IQueryable <T> Sort <T>(this IQueryable <T> source, params PropertySortCondition[] conditions)
        {
            int index = 0;

            foreach (var condition in conditions)
            {
                if (index == 0)
                {
                    source = QuerySortHelper <T> .OrderBy(source, condition.PropertyName, condition.ListSortDirection);
                }
                else
                {
                    source = QuerySortHelper <T> .ThenBy(source, condition.PropertyName, condition.ListSortDirection);
                }
            }

            return(source);
        }