title: Entity Framework -- How are Canonical Functions Different from Linq -- Linq-to-Entities vs Canonical Functions
body: <p>I am reading up on the entity framework and the author is explaining ESQL, canonical functions, and Linq. he does not explain what canonical functions are and why they are needed. The code that he uses in the book can be easily converted to Linq. Where do canonical functions play in the Entity framework? Can I use canonical functions instead of linq and EQSL? What are the pros/cons of canonical functions.</p>
  
  <p><strong>canonical function</strong></p>
  
  <pre><code>var query = context.question
              .Where(c =&gt; c.question_id == 1)
              .Select((c) =&gt; new { c.question_id });
  </code></pre>
  
  <p><strong>Linq</strong>  </p>
  
  <pre><code>var query = from p in context.question
                      where p.question_id == 1
                      select new { p, p.question_title};
  </code></pre>