Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Chapter 11 (Inside Expression Trees) and chapter 12 (Extending Linq) of Programming Microsoft Linq (ISBN 13: 978-0-7356-2400-9 or ISBN 10: 0-7356-2400-3) has been invaluable for me. I haven't read Jons book, but he is a quality guy and explains things well, so I assume that his coverage would also be good.</p> <p>Another great resource is <a href="http://community.bartdesmet.net/blogs/bart/archive/tags/LINQ/default.aspx" rel="noreferrer">Bart De Smet's blog</a> </p> <p>Also, keep your eye on MSDN, the sample code for building a <a href="http://code.msdn.microsoft.com/SimpleLingToDatabase/Release/ProjectReleases.aspx?ReleaseId=1471" rel="noreferrer">Simple Linq to Database</a> (by Pedram Rezaei) is about to get about 40 pages of Doco explaining it.</p> <p>A really, really useful resource for Expression Tree's in fact I would regard it as a <em>must have</em> is the <a href="http://msdn.microsoft.com/en-us/library/bb397975.aspx" rel="noreferrer">Expression Tree Visualiser</a> debugging tool.</p> <p>You should also learn as much as you can about Expression Tree Visitors, there is a pretty good base class inplementation <a href="http://msdn.microsoft.com/en-us/library/bb882521.aspx" rel="noreferrer">here</a>. </p> <p>Here is some sample code derived from that Visitor class to do some debugging (I based this on some sample code in the book I mentioned) the prependIndent method call is just an extension method on a string to put a "--" at each indent level.</p> <pre><code> internal class DebugDisplayTree : ExpressionVisitor { private int indentLevel = 0; protected override System.Linq.Expressions.Expression Visit(Expression exp) { if (exp != null) { Trace.WriteLine(string.Format("{0} : {1} ", exp.NodeType, exp.GetType().ToString()).PrependIndent(indentLevel)); } indentLevel++; Expression result = base.Visit(exp); indentLevel--; return result; } ... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload