public IDisposable CreateScope()
        {
            var currentState = translator.state;
            var newState     = new TranslatorState(currentState);

            translator.state = newState;
            return(new Disposable(_ => translator.state = currentState));
        }
        public IDisposable CreateLambdaScope(LambdaExpression le)
        {
            var currentState = translator.state;
            var newState     = new TranslatorState(currentState);

            newState.OuterParameters  = newState.OuterParameters.Concat(newState.Parameters).ToArray();
            newState.Parameters       = Enumerable.ToArray(le.Parameters);
            newState.CurrentLambda    = le;
            newState.IncludeAlgorithm = IncludeAlgorithm;
            newState.IsTailMethod     = IsTailMethod;
            translator.state          = newState;
            return(new Disposable(_ => translator.state = currentState));
        }
 private TranslatorState(TranslatorState currentState)
 {
     translator                      = currentState.translator;
     Parameters                      = currentState.Parameters;
     OuterParameters                 = currentState.OuterParameters;
     CalculateExpressions            = currentState.CalculateExpressions;
     BuildingProjection              = currentState.BuildingProjection;
     CurrentLambda                   = currentState.CurrentLambda;
     JoinLocalCollectionEntity       = currentState.JoinLocalCollectionEntity;
     AllowCalculableColumnCombine    = currentState.AllowCalculableColumnCombine;
     IncludeAlgorithm                = currentState.IncludeAlgorithm;
     IsTailMethod                    = currentState.IsTailMethod;
     GroupingKey                     = currentState.GroupingKey;
     RequestCalculateExpressionsOnce = currentState.RequestCalculateExpressionsOnce;
     RequestCalculateExpressions     = currentState.RequestCalculateExpressions;
     TypeOfEntityStoredInKey         = currentState.TypeOfEntityStoredInKey;
     ShouldOmmitConvertToObject      = currentState.ShouldOmmitConvertToObject;
 }
        // Constructors

        /// <exception cref="InvalidOperationException">There is no current <see cref="Session"/>.</exception>
        internal Translator(TranslatorContext context)
        {
            this.context = context;
            state        = new TranslatorState(this);
        }
Exemplo n.º 5
0
 public TranslatorScope(Translator translator, TranslatorState previousState)
 {
     this.translator    = translator;
     this.previousState = previousState;
 }
        // Constructors

        /// <exception cref="InvalidOperationException">There is no current <see cref="Session"/>.</exception>
        internal Translator(TranslatorContext context, CompiledQueryProcessingScope compiledQueryScope)
        {
            this.compiledQueryScope = compiledQueryScope;
            this.context            = context;
            state = new TranslatorState(this);
        }