Castle ActiveRecord FindByPrimaryKey在DataReader读取内部抛出错误

时间:2012-01-05 13:00:32

标签: c# nhibernate castle-activerecord castle datareader

我正在使用nhibernate con castle activerecord obj是继承ActiveRecordBase类

的类的实例
while (dataReader.Read())
{
    // this line throws an error
    obj.FindByPrimaryKey(dataReader.GetValue("key"));
}

为什么 活动记录0.0.1.7 NHibernate 1.0.2.0 执行FindByPrimaryKey无错误

和 Active Record 3.0.0.0 NHibernate 3.1.0.4000 执行时FindByPrimaryKey抛出异常:

"There is already an open DataReader associated with this Command which must be closed first."

知道DataReader打开时,Connection正由DataReader独占使用。在原始DataReader关闭之前,您将无法为Connection执行任何命令,包括创建另一个DataReader。

为什么代码在旧版本中执行时没有错误,并在最新版本中引发错误?

0 个答案:

没有答案
相关问题