hi.. I am newbie of nhibernate. I build winform application using Nhibernate which has add/delete/edit/retrieve process, but I am not understand when to open session or close session or clear session.
I used open session on event Load Form and close when I unload form. but the effect ever time I retrieve data I should clear session first and then retrieved because if I did not clear session, system will retrieve not live data(after I updated or add new).
but I got example on google.they put open session and close session on process/function. like: public sub retrieved_all() Dim sessionfactory As ISessionFactory = New Configuration().Configure().BuildSessionFactory session = sessionfactory.OpenSession '....retrieved process session.close() end sub
could everyone help me when to use open/clear and close session
thanks for your helping
|