示例#1
0
        // Utility translator method for lambda expressions. Given a lambda expression and its translated
        // inputs, translates the lambda expression
        private DbExpression TranslateLambda(LambdaExpression lambda, DbExpression input)
        {
            var scopeBinding = new Binding(lambda.Parameters[0], input);

            // push the binding scope
            _bindingContext.PushBindingScope(scopeBinding);

            // translate expression within this binding scope
#if DEBUG
            var preValue = _ignoreInclude;
#endif
            _ignoreInclude++;
            var result = TranslateExpression(lambda.Body);
            _ignoreInclude--;
#if DEBUG
            Debug.Assert(preValue == _ignoreInclude);
#endif

            // pop binding scope
            _bindingContext.PopBindingScope();

            return result;
        }
 /// <summary>
 ///     Set up a new binding scope where parameter expressions map to their paired CQT expressions.
 /// </summary>
 /// <param name="binding"> DbExpression/LinqExpression binding </param>
 internal void PushBindingScope(Binding binding)
 {
     _scopes.Push(binding);
 }