Convert Linq to Expression Tree Code
Surprised I couldn't find this in the Forum. Trying to decide which edition to buy. Love the Expression Tree visualizer. I need to convert a given Linq to EF Queryable to the c# code necessary to build its Expression Tree. Is that even possible? Can I at least glean the ET components necessary – i.e., Expression.Parameter, Expression.MakeMemberAccess, Expression.Lambda, Expression.Call
, etc.? My overriding goal is a deeper dive into ETs than the tutorials I've found specifically to learn how to create complex dynamic queries.
Comments
LINQPad is very useful for this - you can create the
query
and then dump thequery.Expression
member as anExpression
tree.Consider
There's also a lot of helpful questions and answers on StackOverflow.
That would be a good feature - it would be analogous to what happens when you click 'Tree' (for the Roslyn syntax tree) and then click 'Build with Roslyn Factory Methods'.
Writing this would be a lot of work, though, unless a library already exists to do the heavy lifting. A quick search of NuGet and github reveals nothing... are you aware of any such project?