我想使用 MVC Mini Profiler 进行实体框架连接。我这样做的方式是这样的:
public static XXXXX.DAL.BO.XXXXXEntities GetEntityConnection()
{
var conn = ProfiledDbConnection.Get(new EntityConnection(ConfigurationManager.ConnectionStrings["XXXXXEntities"].ConnectionString));
return ObjectContextUtils.CreateObjectContext<XXXXX.DAL.BO.XXXXXEntities>(conn);
}
所以下面这行是获取其余代码的上下文:
XXXXX.DAL.BO.XXXXXEntities ctx = GetEntityConnection();
但是,当我尝试在浏览器上查看此站点时,WebDev.WebServer40.exe 崩溃了。
有谁知道为什么?
多谢了。
PS 以前是
XXXXX.DAL.BO.XXXXXEntities ctx = new XXXXX.DAL.BO.XXXXXEntities();
它工作得很好。