MiniProfiler with EntityFramework 6 code first

asp.net-mvc-4 entity-framework-6

Question

I have tried to wire-up a MiniProfiler to an existing project which used EF6 code first, aaaand it just makes me crazy now :)

The problem is that by default MiniProfiler works with EF 4.1, and for 6.0 they have implemented kind of quick solution https://github.com/SamSaffron/MiniProfiler/pull/134

But seems like it doesnt works for me. Everytime I'm launching application I just getting the following exception:

System.InvalidOperationException: The Entity Framework provider type 'StackExchange.Profiling.Data.EFProfiledSqlClientDbProviderServices, MiniProfiler.EntityFramework6' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

Did anybody faced similar issue? Thank you!

Popular Answer

The EF6 nuget has been published. It is available here and can be installed using Install-Package MiniProfiler.EF6 -Pre

To initialize, simply call the following in your application startup logic:

using StackExchange.Profiling.EntityFramework6;

...

protected void Application_Start()
{
    MiniProfilerEF6.Initialize();
}

Be sure to call this before using EF in any way.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why