Search code examples
c#.netnhibernatefluent-nhibernate

NHibernate - When FlushMode is given as Never and if I close the session by session.Close(), will the changes be sent to server?


If I have the FlushMode as Never and if I do a session.Close() will the changes be persisted to the database?

Or do we have to explicitly say session.Flush() before session.Close()?

Thanks


Solution

  • Close() never flushes for you (whether you have FlushMode=Never or not), and even if it did, you shouldn't depend on that.

    See: http://nhibernate.info/doc/nh/en/index.html#manipulatingdata-flushing