Exemple #1
0
        /// <summary>
        /// We have to protect the lambda expression's parameters from accidental translation.
        ///
        /// If a parameter is called "t" to a lambda function, and the parameter is defined above us in some other
        /// context, then we need to make sure that we hide it here so as we translate the expression we don't
        /// accidentally translate the rest of the stuff!
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        protected override Expression VisitLambda <T>(Expression <T> expression)
        {
            var popers = (from a in expression.Parameters
                          select _context.Remove(a.Name)).ToArray();

            var result = base.VisitLambda(expression);

            foreach (var p in popers)
            {
                p.Pop();
            }

            return(result);
        }