Quote:
- If you open long-lived sessions in separate windows in an MDI interface these session can get out of sync among themselves, do you face that problem as well?
We try to solve problems here as they appear and so far we didn´t face that problem yet.
We dont try to keep updated objects everywhere in the application because we never had this problem before using NHibernate. GUI interfaces get naturally outdated the more time passes.
Quote:
- The NHibernate session is an identity map. Now imho a session is too vulnarable (not exception-proof) to use it as an application-wide identity map, e.g. in a service layer. But if such an identity map is desirable, how can NHibernate help us?
Because Session is so vulnerable, we decided to one session per window and one session per business logic transaction. (per service in your case)
If an exception occurs, most of time it is in business logic.(service layer)
Exceptions in window sessions are very rare and usually happens due to wrong nhibernate mappings or problems related to the database such as time out limit.
Anyway we decided to take that risk and if a window session exception occurs, the user will have to close and re-open it again.
This approach has recently proved to be sufficiently stable to put our software in production here.