我正在尝试将 MiniProfiler 添加到我的 DB2 连接中。下面是我的简化代码。
public void InitializeConnection()
{
DB2Connection cnn = new DB2Connection("connection String");
var profiler =
new StackExchange.Profiling.Data.ProfiledDbConnection(cnn, MiniProfiler.Current);
IDbCommand c = new DB2Command();
c.Connection = profiler ;
}
我的问题出现在将分析器分配给 DB2Command 的 Connection 属性的最后一行。我收到以下错误。
无法将“StackExchange.Profiling.Data.ProfiledDbConnection”类型的对象转换为“IBM.Data.DB2.DB2Connection”类型我尝试了几种不同的转换想法,但都没有成功。