6

I am trying to write a module to append a comment containing useful information to every Linq2Entities SQL query emitted by an entity framework DbContext (the information will be used in debugging).

Using Linq2Sql, I had previously accomplished this via extending the MvcMiniProfiler ProfiledDbCommand command class. However, I can't get the same approach to work with EF/DbContext. I've extending EFProfiledDbCommand, but that doesn't work. Indeed, even a straight use of EFProfiledDbCommand doesn't work: I get the error

Unable to determine the provider name for connection of type 'MvcMiniProfiler.Data.EFProfiledDbConnection'.

Can anyone supply either workaround for my current solution or an alternate approach to this problem?

Akhil
  • 7,570
  • 1
  • 24
  • 23
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
  • 1
    Hi, have a look here : http://stackoverflow.com/questions/6295802/how-do-you-use-the-mvc-mini-profiler-with-entity-framework-4-1 – Giorgio Minardi Feb 13 '12 at 22:41
  • 2
    You might find the [Entity Framework Tracing Provider](http://nuget.org/packages/CommunityEFProviderWrappers.EFTracingProvider) of interest. – AakashM Feb 14 '12 at 09:11
  • EFHooks also comes to mind: http://www.mcdev.za.net/efhooks-project/ – jessehouwing Mar 12 '12 at 19:06

1 Answers1

1

It appears the answer is in the comment by @Giorgio: How do you use the mvc-mini-profiler with Entity Framework 4.1 and Using mvc-mini-profiler database profiling with Entity Framework Code First and is most easily solved by adding MiniProfiler.EF NuGet package.

Community
  • 1
  • 1
robrich
  • 13,017
  • 7
  • 36
  • 63