A couple of months ago I wrote a post about Odd Profiler Results with Entity Framework 4. Thanks to Olaf Tinnemeyer, we now have a simple work-around that he posted to my question on StackOverflow.
When using the Visual Studio tools to create the Entity Data Model, it automatically builds the Connection String for you, and one of the default settings is to set the MultipleActiveResultSets option to True. If you change this setting to False, then Profiler will properly report that the query was executed within the application database.
Please note that I have not done any load testing to determine what type of performance impact this change might have, so YMMV. But for me, I know it will perform acceptably for our needs, and the greater need in my view is to have accurate Profiler results.
I have posted this work-around to the Connect item that I opened. I still believe that this is a bug in SQL Server and hope that Microsoft will address it in a future release. If you share my concern, I encourage you to login and vote this up.
posted @ Monday, August 09, 2010 11:47 PM