/// <summary> /// 排序 /// </summary> public static IQueryable <object> Sort(this IQueryable <object> query, string sort) { if (!string.IsNullOrEmpty(sort)) { var sorts = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize <Dictionary <string, string>[]>(sort); var propertyPaths = GetPropertyPaths(query.ElementType); if (sort != null && sort.Length > 0) { query = query.OrderBy(string.Join(",", sorts.Select(r => propertyPaths[r["property"]] + " " + r["direction"]))); } } return(query); }