Entity Framework - How canonical functions differ from Linq - Linq-to-Entities versus canonical functions

I am reading about entity framework and the author explains ESQL, canonical functions and Linq. it doesn't explain what the canonical functions are and why they are needed. The code 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 and cons of canonical functions.

canonical function

var query = context.question
            .Where(c => c.question_id == 1)
            .Select((c) => new { c.question_id });

      

Linq

var query = from p in context.question
                    where p.question_id == 1
                    select new { p, p.question_title};

      

+2


source to share


1 answer


No, they are the same, they will compile to (more or more likely) the same bytecode; but sometimes just your command chaining is easier / clearer when writing code.



+2


source







All Articles