Work-Around for Odd Profiler Results with EF4

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


Comments on this entry:

# re: Work-Around for Odd Profiler Results with EF4

Left by Jack Corbett at 8/10/2010 5:07 AM
Interesting results. I wonder if that is a bug in SQL Server or in ADO.NET when it is connecting?

# re: Work-Around for Odd Profiler Results with EF4

Left by AjarnMark at 8/13/2010 9:23 AM
Good question, Jack. I'm guessing that it is really some combination because if I change the Server parameter to a SQL 2000 instance, everything works fine, but I think that is because SQL 2000 does not support MARS, so it behaves as if MARS was turned off.
Comments have been closed on this topic.