public virtual Func <QueryContext, TResult> CreateQueryExecutor <TResult>(Expression query) { query = _queryOptimizerFactory.Create(this).Visit(query); // Convert EntityQueryable to ShapedQueryExpression query = _entityQueryableTranslatorFactory.Create(this).Visit(query); query = _queryableMethodTranslatingExpressionVisitorFactory.Create(Model).Visit(query); query = _shapedQueryOptimizerFactory.Create(this).Visit(query); // Inject actual entity materializer // Inject tracking query = _shapedQueryCompilingExpressionVisitorFactory.Create(this).Visit(query); var queryExecutorExpression = Expression.Lambda <Func <QueryContext, TResult> >( query, QueryContextParameter); try { return(queryExecutorExpression.Compile()); } finally { Logger.QueryExecutionPlanned(new ExpressionPrinter(), queryExecutorExpression); } }
public virtual Func <QueryContext, TResult> CreateQueryExecutor <TResult>(Expression query) { query = _queryOptimizerFactory.Create(this).Visit(query); // Convert EntityQueryable to ShapedQueryExpression query = _entityQueryableTranslatorFactory.Create(this).Visit(query); query = _queryableMethodTranslatingExpressionVisitorFactory.Create(Model).Visit(query); query = _shapedQueryOptimizerFactory.Create(this).Visit(query); // Inject actual entity materializer // Inject tracking query = _shapedQueryCompilingExpressionVisitorFactory.Create(this).Visit(query); return(Expression.Lambda <Func <QueryContext, TResult> >( query, QueryContextParameter) .Compile()); }