Hi folks, I'm seeking further clarification on if (and why) letting the DB, sqlserver for instance manage keys via an auto increment identity is not recommended over generating the ID on the NH side of things.
I've read webpages like: http://nhforge.org/blogs/nhibernate/archive/2009/03/20/nhibernate-poid-generators-revealed.aspx http://ayende.com/blog/3915/nhibernate-avoid-identity-generator-when-possible and have been recommended to choose guid or guid.comb as the PK type if working on a greenfield project, which I am. However guids aren't pretty and we would like to use regular auto increment with sql server unless there is a good reason not to. We might also have a need to insert records outside the context of our app so if we would need to ensure alignment between whatever format of PK NH generates and whatever format our other processes are using to update the DB. I'm aware that there is an extra DB hit required to enable NH to get the ID of an inserted element if we use auto increment as opposed to NH generated ID. I'm also aware that the links above say that auto increment breaks the unit of work, however in my tests I have not found this. Perhaps this is a legacy concern and is not relevent to 3.2 which is what I'm using at the moment. Clarity on this situation is most welcome? Why not use simple stand ints autoincrements? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
