factory, SqlCommands , , RealProxy SqlCommand.
This proxy server can then determine how long ExecuteReader / ExecuteScalar, etc. take it using StopWatch and register it somewhere. The advantage of using this method over Sql Server Profiler is that you can get full stack traces for every instance of SQL that is executed.
source
share