MiniProfiler与EF"模型第一" EDMX模型 [英] MiniProfiler with EF "model first" edmx model

查看:92
本文介绍了MiniProfiler与EF"模型第一" EDMX模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让MiniProfiler来分析我的数据库访问,但我遇到了问题。所有帮助我看到那里似乎是code第一的实体框架连接。我的模型,在code第一次更新是在今年之前的设计,我用设计师创建EDMX模型。 (我一直在使用这将近一年,它似乎是为我工作)

I'm trying to get MiniProfiler to profile my database access but I'm running into problems. All the help I see out there seems to be for "code first" entity framework connections. My model was designed before the code first update was available this year and I used the designer to create the edmx model. (I've been using this for almost a year and it seems to be working for me)

在MiniProfiler文档站点的例子是没有道理给我。我试过它的一些变化,但我有问题。

The example on the MiniProfiler documentation site doesn't make sense to me. I've tried a few variations of it but I'm having problems.

我的模型被称为CYEntities,通常来实例化的ObjectContext我只是这样做
VAR背景=新CYEntities()这里就是我试过对于监视...

My Model is called CYEntities, normally to instantiate an ObjectContext I just do this var context = new CYEntities() here's what I've tried for the profiler...

var dbConnection = new CYEntities().Connection;
var profiledConnection = ProfiledDbConnection.Get(dbConnection);
var context = profiledConnection.CreateObjectContext<CYEntities>(); // this is the context I'd finally use to access data. 

这将引发异常...

System.ArgumentException:无法找到所请求的.NET Framework数据提供程序。它可能没有安装。

我不知道在哪里可以从这里走。

I'm not sure where to go from here.

推荐答案

我有同样的问题。看来,你必须将以下添加到您的web.config,但是,对我来说这将导致w3wp.exe进程崩溃(在Visual Studio中的Web服务器,本地请求)。它似乎并不喜欢的事,是发生在任何人,所以它可能为你工作(请务必插入您正在使用的探查的实际版本)。

I'm having the same issue. It appears that you must add the following to your web.config, however, for me this causes the w3wp.exe process to crash (and the web server in visual studio, for local requests). It doesn't seem like something that is happening to anyone else, so it might work for you (make sure to insert the actual version of the profiler you are using).

<system.data>
  <DbProviderFactories>
    <remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
    <add name="MvcMiniProfiler.Data.ProfiledDbProvider" invariant="MvcMiniProfiler.Data.ProfiledDbProvider" description="MvcMiniProfiler.Data.ProfiledDbProvider" type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.7.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
  </DbProviderFactories>
</system.data>

这篇关于MiniProfiler与EF&QUOT;模型第一&QUOT; EDMX模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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