Пример #1
0
        public override Expression?Visit(Expression?expression)
        {
            if (expression == null)
            {
                return(base.Visit(expression));
            }

            var parentEvaluatable = _evaluatable;

            var parentContainsClosure = _containsClosure;

            _evaluatable = IsEvaluatableNodeType(expression)
                           // Extension point to disable funcletization
                           && _evaluatableExpressionFilter.IsEvaluatableExpression(expression, _model)
                           // Don't evaluate QueryableMethods if in compiled query
                           && (_parameterize || !IsQueryableMethod(expression));
            _containsClosure = false;

            base.Visit(expression);

            if (_evaluatable)
            {
                // Force parameterization when not in lambda
                _evaluatableExpressions[expression] = _containsClosure || !_inLambda;
            }

            _evaluatable     = parentEvaluatable && _evaluatable;
            _containsClosure = parentContainsClosure || _containsClosure;

            return(expression);
        }