// Executes the expression tree that is passed to it. internal static object Execute(Expression expression, bool isEnumerable, LinqToAzureInputs inputs) { // The expression must represent a query over the data source. if (!IsQueryOverDataSource(expression)) throw new InvalidProgramException("No query over the data source was specified."); // Find the call to Where() and get the lambda expression predicate. var factory = new ExecutionFactory(expression, inputs); var queryableStorageAccount = factory.GetConcreteQueryable(); // Copy the expression tree that was passed in, changing only the first // argument of the innermost MethodCallExpression. var treeCopier = new ExpressionTreeModifier(queryableStorageAccount); var newExpressionTree = treeCopier.Visit(expression); // This step creates an IQueryable that executes by replacing Queryable methods with Enumerable methods. return isEnumerable ? queryableStorageAccount.Provider.CreateQuery(newExpressionTree) : queryableStorageAccount.Provider.Execute(newExpressionTree); }
// Executes the expression tree that is passed to it. internal static object Execute(Expression expression, bool isEnumerable, LinqToAzureInputs inputs) { // The expression must represent a query over the data source. if (!IsQueryOverDataSource(expression)) { throw new InvalidProgramException("No query over the data source was specified."); } // Find the call to Where() and get the lambda expression predicate. var factory = new ExecutionFactory(expression, inputs); var queryableStorageAccount = factory.GetConcreteQueryable(); // Copy the expression tree that was passed in, changing only the first // argument of the innermost MethodCallExpression. var treeCopier = new ExpressionTreeModifier(queryableStorageAccount); var newExpressionTree = treeCopier.Visit(expression); // This step creates an IQueryable that executes by replacing Queryable methods with Enumerable methods. return(isEnumerable ? queryableStorageAccount.Provider.CreateQuery(newExpressionTree) : queryableStorageAccount.Provider.Execute(newExpressionTree)); }