在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
原文地址:https://www.cnblogs.com/tangge/p/11497281.html
时间: 2024-11-03 04:51:56