0

The Orderby statment is not supported by the Azure Table storage linq provider I have an Expression like

.Where(t => (t.RowKey.CompareTo("U_") > 0)).OrderBy(user => user.UserName)

i'm trying to remove .OrderBy(user => user.UserName) from the expression tree

I would also like the visitor to remove the orderby statment from the following expression

.Where(t => (t.RowKey.CompareTo("U_") > 0)).OrderBy(user => user.UserName).Take(10)

will become

.Where(t => (t.RowKey.CompareTo("U_") > 0)).Take(10)
svick
  • 236,525
  • 50
  • 385
  • 514
Madu Alikor
  • 2,544
  • 4
  • 21
  • 36

1 Answers1

0

Here's a visitor implementation.

class OrderByRemovalVisitor : ExpressionVisitor
{

    protected override Expression VisitMethodCall(MethodCallExpression node)
    {

        if (node.Method.Name == "OrderBy" && node.Method.DeclaringType == typeof(Queryable))
            return node.Arguments[0];
        else
            return base.VisitMethodCall(node);
    }
}
Shlomo
  • 14,102
  • 3
  • 28
  • 43