According this thread, we can log the generated SQL
via EF
, but what about DbContext.SaveChanges()
? Is there any easy way to do this job without any extra frameworks?
In entity framework 6.0, the Database class has a property Action<string> Log
. so setting up logging is as easy as:
context.Database.Log = Console.WriteLine;
For more advanced needs you can set up an interceptor.