Search code examples
c#mysqlentity-frameworkasp.net-mvc-3mvc-mini-profiler

How do you use the mvc-mini-profiler with Entity Framework 4.1


I am trying to use the mvc-mini-profiler with MVC3 and keep getting the following error

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

Below is the code that I am using to try and instatiate my Context.

DbConnection conn = new MySqlConnection(
    ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);

var profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(conn);
return new DB(profiledConnection);

And here is the DB Context Class.

public class DB:DbContext, Stats.Data.IDB
{
    public DB(DbConnection conn)
        : base(conn, true)
    {

    }...

Solution

  • As of version 1.5 this is now supported see: http://code.google.com/p/mvc-mini-profiler

    The step to configure it are listed here: Using mvc-mini-profiler database profiling with Entity Framework Code First