如何使用实体框架4.1的mvc-mini-profiler [英] How do you use the mvc-mini-profiler with Entity Framework 4.1

查看:114
本文介绍了如何使用实体框架4.1的mvc-mini-profiler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用mvc-mini-profiler与MVC3并且不断得到以下错误



无法确定连接类型为MvcMiniProfiler的提供程序名称。 Data.ProfiledDbConnection'



下面是我用来尝试和调整我的上下文的代码。

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

var profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(conn);
返回新的DB(profiledConnection);

这里是数据库上下文类。

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

} ...


解决方案

从版本1.5开始,现在可以看到: http:// code。 google.com/p/mvc-mini-profiler



配置步骤如下:使用实体框架代码首先使用mvc-mini-profiler数据库分析


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

    }...

解决方案

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

这篇关于如何使用实体框架4.1的mvc-mini-profiler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆