Ejemplo n.º 1
0
                public override Expression Visit(Expression expression)
                {
                    if (expression != null)
                    {
                        var saveCannotBeEvaluated = cannotBeEvaluated;
                        cannotBeEvaluated = false;

                        var query = QueryableHelper.GetQuerableMember(expression);
                        if (query != null)
                        {
                            Visit(query.Expression);
                        }
                        else
                        {
                            base.Visit(expression);
                        }

                        if (!cannotBeEvaluated)
                        {
                            if (fnCanBeEvaluated(expression))
                            {
                                candidates.Add(expression);
                            }
                            else
                            {
                                cannotBeEvaluated = true;
                            }
                        }

                        cannotBeEvaluated |= saveCannotBeEvaluated;
                    }

                    return(expression);
                }
Ejemplo n.º 2
0
                public override Expression Visit(Expression expression)
                {
                    if (expression == null)
                    {
                        return(null);
                    }

                    var query = QueryableHelper.GetQuerableMember(expression);

                    if (query != null)
                    {
                        return(Visit(query.Expression));
                    }
                    else if (candidates.Contains(expression))
                    {
                        return(Evaluate(expression));
                    }

                    return(base.Visit(expression));
                }