/// <summary> /// 动态查询 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="queryable"></param> /// <param name="query"></param> /// <returns></returns> public static IQueryable <T> DynamicQuery <T>(this IQueryable <T> queryable, QueryCondition query) { if (queryable == null) { throw new ArgumentNullException(nameof(queryable)); } if (query == null) { return(queryable); } return(ExpressionExpand <T> .DynamicQuery(queryable, query)); }
/// <summary> /// 动态排序 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="queryable"></param> /// <param name="sortings"></param> /// <returns></returns> public static IQueryable <T> DynamicSort <T>(this IQueryable <T> queryable, IEnumerable <SortingParameter> sortings) { if (queryable == null) { throw new ArgumentNullException(nameof(queryable)); } if (sortings == null || !sortings.Any()) { return(queryable); } return(ExpressionExpand <T> .DynamicSort(queryable, sortings)); }
/// <summary> /// 条件:与 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="this"></param> /// <param name="expression"></param> /// <returns></returns> public static Expression <Func <T, bool> > And <T>(this Expression <Func <T, bool> > @this, Expression <Func <T, bool> > expression) { return(ExpressionExpand <T> .And(@this, expression)); }
/// <summary> /// 获取条件表达式 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public static Expression <Func <T, bool> > GetExpression <T>() { return(ExpressionExpand <T> .GetExpression()); }