NHibernateAvoid identity generator when possible
Before I start, I wanted to explain that NHibernate fully support the identity generator, and you can work with it easily and without pain.
There are, however, implications of using the identity generator in your system. Tuna does a great job in detailing them. The most common issue that you’ll run into is that identity breaks the notion of unit of work. When we use an identity, we have to insert the value to the database as soon as we get it, instead of deferring to a later time. It also render batching useless.
And, just to put some additional icing on the cake. On SQL 2005 and SQL 2008, identity is broken.
I know that “select ain’t broken” most of the time, but this time, it appears it does :-)
We strongly recommend using some other generator strategy, such as guid.comb (similar to new sequential id) or HiLo (which also generates human readable values).