Пример #1
0
        // Constructors

        public TranslatorContext(Session session, CompilerConfiguration rseCompilerConfiguration, Expression query,
                                 CompiledQueryProcessingScope compiledQueryScope)
        {
            ArgumentValidator.EnsureArgumentNotNull(session, nameof(session));
            ArgumentValidator.EnsureArgumentNotNull(rseCompilerConfiguration, nameof(rseCompilerConfiguration));
            ArgumentValidator.EnsureArgumentNotNull(query, nameof(query));

            Domain = session.Domain;
            RseCompilerConfiguration = rseCompilerConfiguration;

            // Applying query preprocessors
            query = Domain.Handler.QueryPreprocessors
                    .Aggregate(query, (current, preprocessor) => ApplyPreprocessor(preprocessor, session, current));

            // Built-in preprocessors
            query     = AggregateOptimizer.Rewrite(query);
            query     = ClosureAccessRewriter.Rewrite(query, compiledQueryScope);
            query     = EqualityRewriter.Rewrite(query);
            query     = EntitySetAccessRewriter.Rewrite(query);
            query     = SubqueryDefaultResultRewriter.Rewrite(query);
            Evaluator = new ExpressionEvaluator(query);
            query     = PersistentIndexerRewriter.Rewrite(query, this);
            Query     = query;

            resultAliasGenerator   = AliasGenerator.Create("#{0}{1}");
            columnAliasGenerator   = AliasGenerator.Create(new[] { "c01umn" });
            CustomCompilerProvider = Domain.Handler.GetMemberCompilerProvider <Expression>();
            Model               = Domain.Model;
            TypeIdRegistry      = session.StorageNode.TypeIdRegistry;
            ProviderInfo        = Domain.Handlers.ProviderInfo;
            Translator          = new Translator(this, compiledQueryScope);
            ParameterExtractor  = new ParameterExtractor(Evaluator);
            Bindings            = new LinqBindingCollection();
            applyParameters     = new Dictionary <CompilableProvider, ApplyParameter>();
            tupleParameters     = new Dictionary <ParameterExpression, Parameter <Tuple> >();
            boundItemProjectors = new Dictionary <ParameterExpression, ItemProjectorExpression>();
        }
Пример #2
0
 public ParameterScope(LinqBindingCollection owner, IReadOnlyCollection <ParameterExpression> parameters)
 {
     this.owner      = owner;
     this.parameters = parameters;
 }