首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何通过mysql连接使用mvc-mini-profiler?

如何通过mysql连接使用mvc-mini-profiler?
EN

Stack Overflow用户
提问于 2011-09-06 22:12:59
回答 1查看 666关注 0票数 1

我当前正在尝试通过MySQL连接使用mvc-mini-profiler。有没有一种方法可以通过某种自定义包装器来做到这一点呢?

代码语言:javascript
复制
var mysqlConn = new MySqlConnection("Data Source=localhost; ...");
string commandText = "SELECT ...";

ProfiledDbConnection profiledConn = new ProfiledDbConnection(mysqlConn, MiniProfiler.Current);           

var sqlCom = new MySqlCommand(commandText, profiledConn); // error, expects MySQLConnection, not DBConnection

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-08 09:05:17

使用:

代码语言:javascript
复制
var sqlCom = profiledConn.CreateCommand(); 
sqlCom.CommandText = commandText; 

截获命令对于分析正常工作至关重要。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7321336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档