注意:当问题没有正确处理读取器/连接时,或者错误是由于处理不当的延迟加载时,我已经经历了数百万个问题.我相信这个问题是另一个问题,可能与MySQL的.NET连接器有关.
我通过其.NET连接器(6.8.3)广泛使用MysqL服务器(5.6)数据库.出于性能原因,所有表都是使用MyISAM引擎创建的.我只有一个进程有一个线程(更新:事实上,它不是真的,见下文)顺序访问数据库,因此不需要事务和并发.
今天,经过几个小时的处理,下面这段代码:
public IEnumerablesqlConnection = this.connectionPool.Take();
this.selectWithSourceVectorCommand.Connection = sqlConnection;
this.selectWithSourceVectorCommand.Parameters["@epsilon"].Value
= this.epsilonEstimator.Epsilon.Min() / 10;
for (int d = 0; d < this.dimensionality; ++d)
{
this.selectWithSourceVectorCommand.Parameters["@source_" + d.ToString()]
.Value = sourceVector[d];
}
// *** the following line (201) throws the exception presented below
using (var reader = this.selectWithSourceVectorCommand.ExecuteReader())
{