你如何使用MVC-迷你探查与实体框架4.1 [英] How do you use the mvc-mini-profiler with Entity Framework 4.1

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

问题描述

我想使用MVC-迷你探查与MVC3和不断收到以下错误

无法确定提供者的名称类型的连接MvcMiniProfiler.Data.ProfiledDbConnection

下面是code,我使用尝试instatiate我的上下文。

 的DbConnection康恩=新的MySqlConnection(
    ConfigurationManager.ConnectionStrings [CONNSTRING]的ConnectionString)。VAR profiledConnection = MvcMiniProfiler.Data.ProfiledDbConnection.Get(康涅狄格州);
返回新的DB(profiledConnection);

这里是DB上下文类。

 公共类DB:的DbContext,Stats.Data.IDB
{
    公共DB(康涅狄格州的DbConnection)
        :基地(康涅狄格州,真)
    {    } ...


解决方案

由于1.5这个版本现在支持见:的 HTTP://$c$c.google.com/p/mvc-mini-profiler

步骤对其进行配置,在这里列出:<一href=\"http://stackoverflow.com/questions/6550046/using-mvc-mini-profiler-database-profiling-with-entity-framework-$c$c-first/6743941#6743941\">Using MVC-迷你探查数据库分析与实体框架code首先

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

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

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