I’m trying to use the mini-profiler with old-style EF code – database-first.
So far:
-
I’ve created a db context using:
string connectionString = GetConnectionString(); var connection = new EntityConnection(connectionString); var profiledConnection = ProfiledDbConnection.Get(connection); _context = profiledConnection.CreateObjectContext<MyEntitiesType>(); -
but then I hit a “Unable to find the requested .Net Framework Data Provider. It may not be installed.”
which I worked around using a<system.data>reference to the MvcMiniProfiler provider:<system.data> <DbProviderFactories> <remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" /> <add name="MvcMiniProfiler.Data.ProfiledDbProvider" invariant="MvcMiniProfiler.Data.ProfiledDbProvider" description="MvcMiniProfiler.Data.ProfiledDbProvider" type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler" /> </DbProviderFactories> </system.data> -
but now I’m hitting a stack overflow somewhere in
C:\Users\sam\Desktop\mvc-mini-profiler\MvcMiniProfiler\Data\ProfiledDbProviderServices.cs. Looking at the latest source I’m wondering if I’ve somehow got the setup wrong for this – if somehow my profiled connection is containing another profiled connection is containing….
Any help/advice?
Update – looking at http://code.google.com/p/mvc-mini-profiler/wiki/FrequentlyAskedQuestions at least one other person has seen the same sort of problem with 1.7 – although (s)he’s doing code first. I’ll keep playing to see if I can work out what to do…
Try 1.9. With the update, I just added the new Initialize method in Application_Start and removed the DbProviderFactories config section and now I have SQL profiling with EF (2 databases even, one with code first and one with database first).