Is there a way I can view the Entity Sql (eSQL) that my Linq-to-entities queries are generating with EF framework (that is, not native SQL, but eSQL, if that makes sense?)
Thanks!
You can't. It is not generated.
Actually, LINQ to Entities queries are translated directly into Expression Tree, and the nodes of this Expression Tree are translated into SQL clauses, and then integrated into a SQL query. No Entity SQL.
var query1 = from person in Database
select person.Name;
You can cast the query1 into ObjectQuery and use the ToTraceString method to see the query.
Console.WriteLine(((ObjectQuery)query1).ToTraceString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With