0

我一直在寻找EntityProfiler的开源替代品。我的项目在 EF 5.0.0 中,我尝试了 MiniProfiler。由于它是一个 webapi 项目,我无法在 UI 中看到跟踪信息。设法找到vxcore.nlog nuget,但它无法记录从实体框架生成的 sql 查询。这是我的代码

 private static Logger mlogger = LogManager.GetCurrentClassLogger();
 mlogger.Trace("mylog information");
 NLogStorage.SetAsStorage(mlogger, LogLevel.Debug); 

using (var test = new testEntities()) {
                var updatedUser = test.students.SingleOrDefault(x => x.StudentName == "John");
            }
mlogger.Trace("mylog information end");

这是我的日志文件输出

20170324013230 SCI-LT-050 ​​在 23-03-2017 20:02:30 http://localhost:61308/ = 4,986.4ms (sql = 23.7ms in 6 cmds)

上面的日志只显示了 sql 的执行时间,而不是查询。有人可以帮忙吗?

4

0 回答 0