So I had to spend couple of days to research and implement generic DbConnection tracing approach that supposed to work with any DbProvider. This approach should work with direct DbConnection as well as with ORM tools (EntityFramework). The idea is to replace standard DbProviderFactories with a wrappers, that will trace all necessary information. The Idea was taken from Glimpse.Ado.
Here is the code:
And here is what you need to add to web.config:
In application initialization module add line:TraceableDbProviderFactory.IsEnabled = true;Enjoy!