how to convert linq query to sql query in entity framework 5 ?
Loading
how to convert linq query to sql query in entity framework 5 ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manish Kumar ChoudharyPosted Nov 28, 2014, 11:51 PM
Hi Namit Kumar,
You can do the following:
var result = from x in appEntities
where x.id = 32
select x;
var sql = ((System.Data.Objects.ObjectQuery)result).ToTraceString();
or Read these links for details
http://msdn.microsoft.com/en-us/magazine/gg490349.aspx
http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/connection-resiliency-and-command-interception-with-the-entity-framework-in-an-asp-net-mvc-application