EF6中的SQL监控

Posted tangge

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EF6中的SQL监控相关的知识,希望对你有一定的参考价值。

在MVC或WEBAPI中的监控

System.Action<string> action = (string message) =>  Debug.WriteLine(message); ;
Context.Database.Log = action;

参考:

Logging Database Commands in Entity Framework(在EF框架中记录数据库命令):
https://www.entityframeworktutorial.net/entityframework6/database-command-logging.aspx
Logging and intercepting database operations(日志记录和拦截数据库操作)
https://docs.microsoft.com/en-us/ef/ef6/fundamentals/logging-and-interception

以上是关于EF6中的SQL监控的主要内容,如果未能解决你的问题,请参考以下文章