none
Where MethodCallExpression and GetQueryText() RRS feed

  • Question

  • For testing purpose, I created a simple project for linq provider.

    Its GetQueryText() function just returns a string:

    public override string GetQueryText(Expression expression)
    {
                return "TestQueryasdfasdfasdf";
    }

    Then i put a break point in my linq query constructor:

    public TestLinqQuery(TestProviderBase provider, Expression expression)
    {

    }

    The expression is a MethodCallExpression. The value of first argument is "TestQueryasdfasdfasdf".

    Anyone can explain why? I also put breakpoint in GetQueryText(), but it has not been reached. Many thanks.

    Sorry, I can not attach image into this post. Forum disabled that to me.

    Monday, October 29, 2012 4:02 AM

Answers

  • Never mind, I found the reason.

    This is due to ToString() method in TestLinqQuery class.

    First argument in Where expression is return type.

    this type is TestLinqQuery<TestItem>.

    • Marked as answer by flyfrog2012 Monday, October 29, 2012 4:29 AM
    Monday, October 29, 2012 4:29 AM