NHibernate generates an identifier when session.Save () or session.SaveOrUpdate () is called with a transition object. At this time, the id property of the object is set and can be used.
If the id generator needs access to the database, this will happen at this time. Thus, for the Identity generator, insertion will be performed at this time, like any pending insertions.
Otherwise, the insertion will be delayed until the session is reset, which will happen:
- Find() Enumerable()
- NHibernate.ITransaction.Commit()
- ISession.Flush()