public static IQueryable <T> QueryAndGroupOr <T>(this IQueryable <T> query, IEnumerable <UosoConditions> conditions) { if (conditions == null) { return(query); } var parser = new UosoExpressionParser <T>(); var filter = parser.AndGroupOr(conditions); return(query.Where(filter)); }
/// <summary> /// 扩展单个And条件 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="query"></param> /// <param name="condition"></param> /// <returns></returns> public static IQueryable <T> QueryAndSingleOr <T>(this IQueryable <T> query, UosoConditions condition) { if (condition == null) { return(query); } var parser = new UosoExpressionParser <T>(); var filter = parser.AndGroupOr(new List <UosoConditions> { condition }); return(query.Where(filter)); }