Unable to setup MiniProfiler w/ Enity Framework 4.0 (Not code first)

情到浓时终转凉″ 提交于 2019-12-03 09:22:26

I was able to get this working by changing my ConnectionHelper class to the following:

    public static class ConnectionHelper
    {
            public static CB_NotificationEntities GetEntityConnection()
            {

                var connectionString = ConfigurationManager.ConnectionStrings["CB_NotificationEntities"].ConnectionString;
                var ecsb = new EntityConnectionStringBuilder(connectionString);
                var sqlConn = new SqlConnection(ecsb.ProviderConnectionString);
                var pConn = new StackExchange.Profiling.Data.EFProfiledDbConnection(sqlConn, MiniProfiler.Current);

                var context = ObjectContextUtils.CreateObjectContext<CB_NotificationEntities>(pConn);
                return context;

          }
     }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!