Using IntelliTrace With Entity Framework In Visual Studio 2012

This is not a big deal, but I have recently bumped into several people that did not know about it so I thought I’d do a blog post just to show what it is and how is just trivial to use for useful stuff.

The issue I’m showing is how to see the Sql generated from Entity Framework.  My old habit use to be to stop the debugger and hover over the query variable in the code, grab it as a debug variable, then cut and paste to SqlServer enterprise.

Now, I just go to the DEBUG menu in VS, Windows / Intellitrace and I get a nice listing on the right side of all my ADO.NET calls.  The last one is the one I just did. 

My code below is pretty self explanatory.  You can see I’ve just issued a db.SaveChanges().  You can also see the Sql generated for the update.  I was checking because I wanted to confirm it was just updating one column.  It was!

image

Hope this helps!

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. This could be very useful if it worked. For some reason IntelliTrace logs ADO.NET events only half way through my program and I can’t seem to figure why it stops logging from a certain point in code execution.

  2. Most of the time I find the auto generated SQL is too long to display in the Intellitrace window and there doesn’t seem to be any way to expand it.

Your Comments

*

Protected with IP Blacklist CloudIP Blacklist Cloud

Follow

Get every new post delivered to your Inbox

Join other followers: