Ejemplo n.º 1
0
        /// <summary>
        /// Linq动态排序再排序(反射.排序名称必须与Model一致)
        /// </summary>
        /// <typeparam name="T">T</typeparam>
        /// <param name="source">要排序的数据源</param>
        /// <param name="value">排序依据(加空格)排序方式</param>
        /// <returns>IOrderedQueryable</returns>
        public static IOrderedQueryable <T> ThenBy <T>(this IOrderedQueryable <T> source, string fieldName, bool isAsc)
        {
            if (fieldName.IsNullOrEmpty())
            {
                return(source);
            }
            string Name = isAsc ? "ThenBy" : "ThenByDescending";

            return(source.ExecuteMethod(fieldName, Name));
        }