Getting feedback from EntityFramework Core through diagnostics
Have you ever wanted to get some diagnostics information about Entity Framework Core when it comes to the actions it’s doing such as when a command is executing or executed, when it’s opening a connection to the database or even when there’s an error, to name just a few? I was searching for a way to be able to get the duration of the query it was executing. I was glad to find out that Entity Framework Core hooks itself into DiagnosticSource, a simple module that allows code to be instrumented for production-time logging of rich data payloads for consumption within the process that was instrumented.1 Getting hooked into the diagnostic pipeline DiagnosticSource uses the observer pattern to notify its observers. If you…
Read more