Winforms and Session

Mar 1, 2015 at 11:59 PM
What is you recomendation on Sessions in WinForms Application

1º Create a Application level Session and all winforms use the same session

2º Create a new Session for every window
(How do i dispose the session? I dot not see a close method on the session)

Mar 2, 2015 at 12:23 AM
you can do either way. Just keep in mind - if you use more than one session, don't mix together entities from different sessions in biz operations. Sessions do not see each other's uncommitted entities. There's nothing wrong with having one global session for the entire application. But in this case keep in mind session is not thread-safe, so if you plan to work on different threads, make sure you access session thru locks.
There's no session.Dispose method - there's nothing to dispose. Just drop it, and it will be collected.