protected override Expression VisitMethodCallExpression (MethodCallExpression expression)
{
ArgumentUtility.CheckNotNull ("expression", expression);
var allItems = expression.Object != null ? new[] { expression.Object }.Concat (expression.Arguments) : expression.Arguments;
var projectionItems = new List<Expression>();
CommandBuilder.AppendSeparated (",", allItems, (cb, expr) => projectionItems.Add (VisitArgumentOfLocalEvaluation (expr)));
var instance = expression.Object != null ? projectionItems.First() : null;
var arguments = expression.Object != null ? projectionItems.Skip (1) : projectionItems;
var newInMemoryProjection = Expression.Call (instance, expression.Method, arguments);
CommandBuilder.SetInMemoryProjectionBody (newInMemoryProjection);
// If there are no projection items, we need to emit a NULL constant for the MethodCallExpression to avoid producing an empty SELECT list
if (projectionItems.Count == 0)
{
VisitExpression (Expression.Constant (null));
// Don't forget to increment the column position!
GetNextColumnID ("");
}
return expression;
}