NHibernate.Linq:会话变为后选择脏 [英] NHibernate.Linq : session becomes dirty after select
问题描述
我有一个简单NHiberntate LINQ查询:
I have a simple NHiberntate linq query:
var queryable = session.Linq<Product>().Where(p => p.Active);
Product[] products = queryable.ToArray();
当下的ToArray()
执行会话变脏( session.IsDirty()
返回真
)。如果该交易将提交有每个产品生成一个UPDATE SQL查询。
The moment the ToArray()
is executed the session becomes dirty (session.IsDirty()
returns true
). If the transaction is commited there is an UPDATE SQL query generated for each product.
为什么产品标记为脏后,一个简单的SQL SELECT?
Why are the products marked as dirty after a simple SQL SELECT?
在这个项目中,我们使用的是如下因素的框架/工具:
In this project we are using the folowing framework/tools:
- 的.Net 3.5 + WPF
- 在NHibernate的2.1.2 + FluentNHibernate
- 的SQLite
- PostSharp 1.5
推荐答案
这个问题被称为鬼
此测试将检测到这样的问题: 的http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.html
this test will detect this kind of problems: http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.html
这是我的改善,更详细一点,因此它会给你更多的信息: 的http://jfromaniello.blogspot.com/2010/02/nhibernate-ghostbuster-version-11.html
this is my improvement, is a little bit more verbose, and thus it will give you more information: http://jfromaniello.blogspot.com/2010/02/nhibernate-ghostbuster-version-11.html
这篇关于NHibernate.Linq:会话变为后选择脏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!