Add a 'no change tracking' test for NHibernate.
FransBouma opened this issue · 3 comments
It has the feature but it's currently not included.
It seems Flushmode is the feature to switch off change tracking but it has absolutely no difference.
In fact FlushMode
is not for disabling tracking, it is just for choosing when flushes occur.
By the way, if by "tracking" it is understood something like "the ORM is somehow notified of changes on entities", there are indeed currently no tracking at all in NHibernate (Hibernate has the option, but it is not ported). Instead, NHibernate keeps in the session a snapshot of the state of each loaded entity at the time it was loaded, and on flush, check each entity current state against the snapshot for detecting if the entity was changed.
This can also be considered as a sort of tracking. In such case, there are two ways of disabling it:
- Use a stateless session. (Opened with
ISessionFactory.OpenStatelessSession()
instead ofOpenSession()
.) Its interface is quite different fromISession
and it is quite more limited, like not handling associations. - Load entities as readonly. Not all querying interfaces have this option. Linq is only getting it in 5.1 (not yet released).
@fredericDelaporte I have a hard time coming up with any energy to change anything for NHibernate considering what happened last year.