I'm currently trying to use the mvc-mini-profiler with a MySQL Connection. Is there a way to do this with some kind of custom wrapper?
var mysqlConn = new MySqlConnection("Data Source=localhost; ...");
str开发者_Go百科ing commandText = "SELECT ...";
ProfiledDbConnection profiledConn = new ProfiledDbConnection(mysqlConn, MiniProfiler.Current);
var sqlCom = new MySqlCommand(commandText, profiledConn); // error, expects MySQLConnection, not DBConnection
thanks!
Use:
var sqlCom = profiledConn.CreateCommand();
sqlCom.CommandText = commandText;
It is critical the commands are intercepted for the profiling to work.
精彩评论