How to make EF log sql queries globally?

前端 未结 2 1030
忘了有多久
忘了有多久 2021-01-29 04:16

How do I \"tell\" EF to log queries globally? I was reading this blog post: EF logging which tells in general how to log sql queries. But I still have

2条回答
  •  粉色の甜心
    2021-01-29 04:39

    1. Whenever you want the context to start logging.
    2. It appears to be done on the context object so it should be done every time you create a new context. You could add this line of code in your constructor though to ensure that it is always enabled.
    3. It will not log if you do not enable the logging.

提交回复
热议问题