Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NHibernate disable id generator for bulk operation

I have to bulk import data into my database using nhibernate and my mapped model. I set up a guid.comb generator for ids. Is there's a way to import data with yet assigned ids disabling temporary guid.comb id generator?

like image 217
Hoghweed Avatar asked Oct 12 '22 15:10

Hoghweed


1 Answers

You can temporarily change the id generator to assigned. Then, after import is finished switch it back to COMB Guids. Just be sure you explicitly call session.Save() instead of SaveOrUpdate(). Does that solve your problem?

like image 107
Filip Zawada Avatar answered Nov 03 '22 01:11

Filip Zawada