locked
System.Linq.Dynamic - Extension Method - Inner Lambda RRS feed

  • Question

  • Hi,

    I'm trying to take advantage of System.Linq.Dynamic dynamic expression tree parse to allow users enter expression and extend my currently hard-coded reports.

    Two limitations I have are use of extnesion methods (specifically for IEnumerable but better be general) and use of lambda expression inside the parsed expression.

    In the following example consider we have class name Foo with properties Range10 that return IEnumerable<int> of 1 through 10. Also x refere to instance of type Foo.

    1. This is example of expression I would like to parse and use extension method:

     

    x.Range10.First()
    In this expression I would like to parser to detect Range10 return IEnumerable<int> and use the extension method First(this IEnumerable<int> e).

     

    2. This example of expression which use inner lambda and extension method

     

    m.Range10.Where(x => x > 5)

     

    In this expression I would like the parser to detect the extension method like before and also parse the inner lambda expression.

     

    I know it's not easy, but I would like to know how hard it is to implement such parser on the existing System.Linq.Dynamic code.

     

    Thank you,

    Ido

    Wednesday, June 30, 2010 8:28 AM

Answers

  • Shortly after posting this quesiton I've found this page

    http://www.cnblogs.com/flysnow-z/archive/2009/06/16/1504338.html

    which explain all I needed and more.

     

    I just wish Microsoft will better publish this things.

     

    Thank you,

    Ido

    • Proposed as answer by John T. Angle Wednesday, June 30, 2010 1:43 PM
    • Marked as answer by Ido Ran Wednesday, June 30, 2010 3:02 PM
    Wednesday, June 30, 2010 9:56 AM