Example #1
0
        /// <summary>
        /// 拼接 and 条件语句
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <returns></returns>
        public static Expression <Func <T, bool> > And <T>(this Expression <Func <T, bool> > first, Expression <Func <T, bool> > second)
        {
            if (first == null)
            {
                return(second);
            }
            if (second == null)
            {
                return(first);
            }

            return(ParameterRebinder.Compose(first, second, Expression.And));
        }
 /// <summary>
 /// Or 条件语句
 /// </summary>
 /// <typeparam name="T">实体类型</typeparam>
 /// <param name="first">条件1</param>
 /// <param name="second">条件2</param>
 /// <returns></returns>
 public static Expression <Func <T, bool> > Or <T>(this Expression <Func <T, bool> > first,
                                                   Expression <Func <T, bool> > second)
 {
     return(ParameterRebinder.Compose(first, second, Expression.Or));
 }