When I started using nhibernate I just did what I always used an incrementing int. Now that I know more about nhibernate and the unit of work I feel like incrementing ints are not a good way to go(they break the unit of work).
I am wondering what should I use as a primary key? Should I use a GUID or a HILO?
I like GUID ask they are unique but I don't like that they can take up alot of room if you start getting a huge db.
I have not used HILO but I think you need a special hilo table to make it work what kinda sucks.
What are peoples thoughts.
Also eventually when I have time I would like to convert my old code to use this new PK data type so I can start making better use of unit of work.
What is the best way to convert ok data to the PK? Is using one of the 2 datatypes I talked about easier to convert than the other?
GUID should be used in situations where you need cross DB replication for example. And not standard GUID, it will mess your indexes. There is a Guid.Comb in NH.
As for HILO - used it only once for batching. Dont like the idea of using extra table. After that moved to natural keys.
Basicaly I would suggest to use Guid.Comb. Here is some reading about this stuff:
Using The Guid.Comb Identifier Strategy