Search code examples
asp.net-mvc-3entity-framework-4.1mvc-mini-profiler

Can you get EF method name from mvc-mini-profiler?


I am using EF D4.1 atabase first for an MVC 3 project. When I see the SQL for my EF methods, it's hard to know which method generated this SQL.

Next to SQL I see a generic description like this: ExecuteStoreCommands Execute GetResults System.Collections.Generic.IEnumerable.GetEnumerator b__2

Is there a way to know which line number from a current file caused this call or at least which entity query was executing?


Solution

  • I was able to get around this by wrapping my EF class into a step, using something like this:

    using (MiniProfiler.Current.Step("MyClass:MyMethod"))
    {
       ...
    }
    

    Not sure if there is a more elegant solution / automatic way to see where the call is made on the stack