I\'m struggling to get my head round how the HiLo generator works in NHibernate. I\'ve read the explanation here which made things a little clearer.
My understanding
NHibernate 3.1.1 does this to generate ID using HiLo
if (lo > maxLo)
{
long hival =
lo = hival == 0 ? 1 : 0;
hi = hival * (this.maxLo + 1L);
}
long result = hi + lo;
lo++;
return result;
Inside NHibernate configuration you specify maxLo. If maxLo is set to 100 you will get 101 ids for each hi value.