Exemple #1
0
        public void ResolveExpression(ResolveExpress re, Expression exp)
        {
            ResolveExpress.MemberType type = ResolveExpress.MemberType.None;
            var expStr    = exp.ToString();
            var isNotBool = !expStr.Contains("True") && !expStr.Contains("False");

            if (isNotBool)
            {
                this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type));
            }
            else
            {
                var isTrue  = Regex.IsMatch(expStr, @"\=\> True$");
                var isFalse = Regex.IsMatch(expStr, @"\=\> False$");
                if (isFalse)
                {
                    this.SqlWhere = string.Format(" AND 1<>1 ");
                }
                else if (isTrue)
                {
                }
                else
                {
                    this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type));
                }
            }
        }
Exemple #2
0
        public void ResolveExpression(ResolveExpress re, Expression exp)
        {
            ResolveExpress.MemberType type = ResolveExpress.MemberType.None;
            var expStr        = exp.ToString();
            var isNotBool     = !expStr.Contains("True") && !expStr.Contains("False");
            var isContainsNot = expStr.Contains("Not");

            if (isContainsNot && expStr.IsMatch(@" => Not\(.+?\)"))
            {
                this.SqlWhere = string.Format(" AND {0}=0 or {0} is null ", Regex.Match(expStr, @" => Not\(.+\.(.+?)\)").Groups[1].Value);
            }
            else if (isNotBool)
            {
                this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type));
            }
            else
            {
                var isTrue  = Regex.IsMatch(expStr, @"\=\> True$");
                var isFalse = Regex.IsMatch(expStr, @"\=\> False$");
                if (isFalse)
                {
                    this.SqlWhere = string.Format(" AND 1<>1 ");
                }
                else if (isTrue)
                {
                }
                else
                {
                    this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type));
                }
            }
        }
Exemple #3
0
 /// <summary>
 /// 初始化表达式
 /// </summary>
 /// <param name="re"></param>
 /// <param name="exp"></param>
 private void Init(ResolveExpress re, Expression exp)
 {
     ResolveExpress.MemberType type = ResolveExpress.MemberType.None;
     //解析表达式
     this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type, true));
     //还原bool值
     foreach (var item in ConstantBoolDictionary)
     {
         if (this.SqlWhere.IsValuable())
         {
             this.SqlWhere = this.SqlWhere.Replace(item.Key.ToString(), item.ConditionalValue);
         }
     }
 }
Exemple #4
0
 public void ResolveExpression(ResolveExpress re, Expression exp)
 {
     ResolveExpress.MemberType type = ResolveExpress.MemberType.None;
     this.SqlWhere = string.Format(" AND {0} ", re.CreateSqlElements(exp, ref type));
 }