protected override Expression VisitMethodCall(MethodCallExpression expression)
        {
            ArgumentUtility.CheckNotNull("expression", expression);

            // Method calls are only evaluatable if they do not involve IQueryable objects.

            if (IsQueryableExpression(expression.Object))
            {
                _isCurrentSubtreeEvaluatable = false;
            }

            for (int i = 0; i < expression.Arguments.Count && _isCurrentSubtreeEvaluatable; i++)
            {
                if (IsQueryableExpression(expression.Arguments[i]))
                {
                    _isCurrentSubtreeEvaluatable = false;
                }
            }

            var vistedExpression = base.VisitMethodCall(expression);

            // Testing the parent expression is only required if all children are evaluatable
            if (_isCurrentSubtreeEvaluatable)
            {
                _isCurrentSubtreeEvaluatable = _evaluatableExpressionFilter.IsEvaluatableMethodCall(expression);
            }

            return(vistedExpression);
        }
Esempio n. 2
0
        protected override Expression VisitMethodCall(MethodCallExpression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            // Method calls are only evaluatable if they do not involve IQueryable objects.

            if (IsQueryableExpression(expression.Object))
            {
                IsCurrentSubtreeEvaluatable = false;
            }

            for (int i = 0; i < expression.Arguments.Count && IsCurrentSubtreeEvaluatable; ++i)
            {
                if (IsQueryableExpression(expression.Arguments[i]))
                {
                    IsCurrentSubtreeEvaluatable = false;
                }
            }

            var vistedExpression = base.VisitMethodCall(expression);

            // Testing the parent expression is only required if all children are evaluatable
            if (IsCurrentSubtreeEvaluatable)
            {
                IsCurrentSubtreeEvaluatable = EvaluatableExpressionFilter.IsEvaluatableMethodCall(expression);
            }

            return(vistedExpression);
        }