public static SelectExpression RemoveOrderExpression(this SelectExpression select, OrderExpression ordering) { if (select.OrderBy != null && select.OrderBy.Count > 0) { List <OrderExpression> orderby = new List <OrderExpression>(select.OrderBy); orderby.Remove(ordering); return(select.SetOrderBy(orderby)); } return(select); }
public static SelectExpression AddOrderExpression(this SelectExpression select, OrderExpression ordering) { List <OrderExpression> orderby = new List <OrderExpression>(); if (select.OrderBy != null) { orderby.AddRange(select.OrderBy); } orderby.Add(ordering); return(select.SetOrderBy(orderby)); }