예제 #1
0
 public PageQueryItem(
     string name,
     string value,
     ExpressionOperate operate = ExpressionOperate.Equal,
     IfBuild ifBuild           = IfBuild.IsNotNullOrWhiteSpace)
 {
     Name    = name;
     Value   = value;
     Operate = operate;
     IfBuild = ifBuild;
 }
예제 #2
0
        public static Expression Create(ParameterExpression exp1, string name, Type type, string value, ExpressionOperate operate)
        {
            switch (operate)
            {
            case ExpressionOperate.Equal:
                return(CreateEqual(exp1, name, type, value));

            case ExpressionOperate.Like:
                if (!type.Equals(typeof(string)))
                {
                    throw new ArgumentException("operate like 's type should be string!");
                }
                return(CreateLike(exp1, name, value));

            case ExpressionOperate.Contains:
                return(CreateContains(exp1, name, type, value));

            case ExpressionOperate.IsNull:
                return(CreateNull(exp1, name, type));

            case ExpressionOperate.IsNotNull:
                return(CreateNotNull(exp1, name, type));

            default:
                throw new NotSupportedException(operate.ToString());
            }
        }
예제 #3
0
        public static Expression <Func <T, bool> > Create <T>(Expression <Func <T, bool> > predicate, string name, string value, ExpressionOperate operate, bool isAnd)
        {
            var right = Create(predicate.Parameters[0], name, typeof(T).GetProperty(name).PropertyType, value, operate);

            return(Combine(predicate, right, isAnd));
        }