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!
Hope this helps!