I'm trying to use the mvc-mini-profiler with EFCodeFirst I'm creating a DbProfiledConnection and passing it to the DbContext on construction as below. The application continues to work as expected by the sql is not exposed to the Profiler.
public class WebContext : DbContext
{
static DbConnection _connection = new SqlConnection(ConfigurationManager.ConnectionStrings["WebContext"].ConnectionString);
static DbConnection _profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(_connection);
public WebContext()
: base(_profiledConnection, true)
{
}
oops my bad.
I've modified it so that when my WebContext is constructed in my UnitOfWork i pass in a ProfiledDbConnection
public UnitOfWork()
{
var profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(connection);
this.context = new MyContext(profiledConnection);
}
I've checked and MiniProfier Current has been set in Application_BeginRequest and it returns a ProfiledDbConnection when I then try and query the database an error is thrown in the ProfiledDbProviderServices class.
protected override string GetDbProviderManifestToken(DbConnection connection)
{
return tail.GetProviderManifestToken(connection);
}
this method returns a "The provider did not return a ProviderManifestToken string." error