Beispiel #1
0
        private bool VisitMethod_Enumerable(MethodCallExpression exp)
        {
            var args = exp.Arguments;

            switch (exp.Method.Name)
            {
            case LinqConsts.EnumerableMethod_Contains:
                if (args.Count == 2)
                {
                    _operator = _hasNot ? PropertyOperator.NotIn : PropertyOperator.In;
                    this.Visit(args[1]);    //先访问属性
                    this.Visit(args[0]);    //再访问列表常量
                    this.MakeConstraint();
                    return(true);
                }
                break;

            case LinqConsts.EnumerableMethod_Any:
            case LinqConsts.EnumerableMethod_All:
                var subQueryBuilder = new SubEntityQueryBuilder();
                _constraintResult = subQueryBuilder.Build(exp, _query, this.PropertyFinder);
                this.MakeConstraint();
                return(true);

            default:
                break;
            }
            return(false);
        }
Beispiel #2
0
 private bool VisitMethod_Enumerable(MethodCallExpression exp)
 {
     var args = exp.Arguments;
     switch (exp.Method.Name)
     {
         case LinqConsts.EnumerableMethod_Contains:
             if (args.Count == 2)
             {
                 _operator = _hasNot ? PropertyOperator.NotIn : PropertyOperator.In;
                 this.Visit(args[1]);//先访问属性
                 this.Visit(args[0]);//再访问列表常量
                 this.MakeConstraint();
                 return true;
             }
             break;
         case LinqConsts.EnumerableMethod_Any:
         case LinqConsts.EnumerableMethod_All:
             var subQueryBuilder = new SubEntityQueryBuilder();
             _constraintResult = subQueryBuilder.Build(exp, _query, this.PropertyFinder);
             this.MakeConstraint();
             return true;
         default:
             break;
     }
     return false;
 }