在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