Hello,
We are using NHibernate within a WPF desktop application and would like to implement a feature for tracking whether a save is required prior to exiting a screen. Before building something custom, we decided to see if we could use ISession.IsDirty to detect when a save is required. We found that it seems to work for most situations, but if a flush occurs, it looks like IsDirty is set back to false. The changes have been written to the database but not committed, so I think we would need to be able to detect this condition.
Timing for what we are seeing:
1. Start new session (IsDirty = false)
2. Query object of type Foo (IsDirty = false)
3. Modify foo instance (IsDirty = true)
4. Execute query for objects of type Foo (this flushes)
5. Check session.IsDirty and it is now false.
Other than ISession.IsDirty, is there another way from within NHibernate to detect that even though the session state and database are in sync, we still have changes to be committed? We have looked at listeners and events, but aren't 100% sure about that approach.
Any suggestions or guidance on this would be greatly appreciated. Thank you,
Pat