/// <summary> /// /// </summary> /// <param name="select"></param> /// <param name="expression"></param> /// <returns></returns> public static SelectExpression RemoveGroupExpression(this SelectExpression select, Expression expression) { if (select.GroupBy != null && select.GroupBy.Count > 0) { List <Expression> groupby = new List <Expression>(select.GroupBy); groupby.Remove(expression); return(select.SetGroupBy(groupby)); } return(select); }
/// <summary> /// /// </summary> /// <param name="select"></param> /// <param name="expression"></param> /// <returns></returns> public static SelectExpression AddGroupExpression(this SelectExpression select, Expression expression) { List <Expression> groupby = new List <Expression>(); if (select.GroupBy != null) { groupby.AddRange(select.GroupBy); } groupby.Add(expression); return(select.SetGroupBy(groupby)); }