Reputation: 4638
I have a simple NHiberntate linq query:
var queryable = session.Linq<Product>().Where(p => p.Active);
Product[] products = queryable.ToArray();
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.
Why are the products marked as dirty after a simple SQL SELECT?
In this project we are using the folowing framework/tools:
Upvotes: 2
Views: 736
Reputation: 14156
this problem is called "Ghost"
this test will detect this kind of problems: http://fabiomaulo.blogspot.com/2008/10/how-test-your-mappings-ghostbuster.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
Upvotes: 3