0

I just hooked up MiniProfiler to my MVC3 project. I am using EF4.0 and generating POCO classes for my entities.

If it matters, these generated ObjectContexts use ObjectSet<>. I am also using NInject for IoC on the contexts. (I had these in RequestScope, but I changed them to TransientScope to rule that issue out).

All of the profiling that I am seeing is showing "ExecuteStoreCommands" as the query.

Any ideas as to why "ExecuteStoreCommands" would be showing up instead of the SQL? I see real sql in SQL Profiler that looks like this:

exec sp_executesql N'SELECT 
[Project2].[OrderID] AS [OrderID], 
... 

Am I having trouble because I'm not on EF4.1/4.2/4.3? Is it because I didn't use CodeFirst? Is it the POCOs?

Adam Tegen
  • 25,378
  • 33
  • 125
  • 153

1 Answers1

0

It looks like I'm having trouble with the MiniProfiler library. The serialization of the SqlTiming object (via FromJSON) saves the FormattedCommandString which only has a get method. On deserialization, this meant that the CommandString and FormattedCommandString were both null.

The quick (hacky) fix before Deserialization was:

profilerString = profilerString.Replace("FormattedCommandString", "CommandString");
var profiler = MiniProfiler.FromJson(profilerString);                
Adam Tegen
  • 25,378
  • 33
  • 125
  • 153