Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
    {

    }...
like image 781
runxc1 Bret Ferrier Avatar asked Jun 09 '11 16:06

runxc1 Bret Ferrier


People also ask

Do you have to use Entity Framework with MVC?

No it is not a must. You can implement your database layer. But the thing you need is define Models for MVC: public class MyClass { [Display(Name = "SomeName")] [Required(ErrorMessage = "required")] public int?

What is a mini profiler?

MiniProfiler is an open source profiling library which monitors the performance of a . NET application. It is very lightweight and fast. Using this, we can easily track a performance issue with our application. It was created by Stack Overflow Team member.

How can add Entity Framework in ASP NET MVC?

Right-click the Controllers folder in Solution Explorer, select Add, and then click New Scaffolded Item. In the Add Scaffold dialog box, select MVC 5 Controller with views, using Entity Framework, and then choose Add.

What is Entity Framework in MVC with example?

Entity framework is an ORM (Object Relational Mapping) tool. Object Relational Mapping (ORM) is a technique of accessing a relational database; . i.e., whatever has tables and store procedure these things we interact with database in class, method and property of the object format.


1 Answers

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

like image 154
Chance Avatar answered Sep 27 '22 15:09

Chance