/// <summary> /// 初始化一个<see cref="FilterRule"/>类型的新实例 /// </summary> /// <param name="field">数据名称</param> /// <param name="value">数据值</param> /// <param name="operateCode">操作方式的前台码</param> public FilterRule(string field, object value, string operateCode) : this(field, value, FilterHelper.GetFilterOperate(operateCode)) { }
/// <summary> /// 获取指定查询条件组的查询表达式 /// </summary> /// <typeparam name="T">表达式实体类型</typeparam> /// <param name="group">查询条件组,如果为null,则直接返回 true 表达式</param> /// <returns>查询表达式</returns> public virtual Expression <Func <T, bool> > GetExpression <T>(FilterGroup group) { return(FilterHelper.GetExpression <T>(group)); }
/// <summary> /// 获取指定查询条件的查询表达式 /// </summary> /// <typeparam name="T">表达式实体类型</typeparam> /// <param name="rule">查询条件,如果为null,则直接返回 true 表达式</param> /// <returns>查询表达式</returns> public virtual Expression <Func <T, bool> > GetExpression <T>(FilterRule rule) { return(FilterHelper.GetExpression <T>(rule)); }
/// <summary> /// 验证指定查询条件组是否能正常转换为表达式 /// </summary> /// <param name="group">查询条件组</param> /// <param name="type">实体类型</param> /// <returns>验证操作结果</returns> public virtual OperationResult CheckFilterGroup(FilterGroup group, Type type) { return(FilterHelper.CheckFilterGroup(group, type)); }
/// <summary> /// 初始化一个<see cref="FilterGroup"/>类型的新实例 /// </summary> /// <param name="operateCode">条件间操作方式的前台码</param> public FilterGroup(string operateCode) : this(FilterHelper.GetFilterOperate(operateCode)) { }
/// <summary> /// 将条件转换为查询表达式 /// </summary> public static Expression <Func <TEntity, bool> > ToExpression <TEntity>(this FilterRule rule) { return(FilterHelper.GetExpression <TEntity>(rule)); }
/// <summary> /// 将条件组转换为查询表达式 /// </summary> public static Expression <Func <TEntity, bool> > ToExpression <TEntity>(this FilterGroup group) { return(FilterHelper.GetExpression <TEntity>(group)); }
/// <summary> /// 获取指定字段和条件组表达式 /// </summary> /// <typeparam name="T">表达式实体类型</typeparam> /// <param name="group">查询条件组,如果为null,则直接返回 true 表达式</param> /// <param name="filterfields">查询过滤字段集合</param> /// <returns>查询表达式</returns> public Expression <Func <T, bool> > GetExpression <T>(FilterGroup group, IDictionary <string, string> filterfields) { return(FilterHelper.GetExpression <T>(group, filterfields)); }