NHibernate - how to switch dynamically the generator for Id?
问题 Right now I have all my mappings as hbm.xml. I want to switch dynamically the type of Id generator for certain entities from 'identity' to 'assigned' at runtime (application start). This is because I need to support importing data from previous system and keep existing ids. Is this possible? How? 回答1: The generator is part of the mappings, so you need to change the mappings before creating the session factory. This is easy to do with Fluent or ConfORM. It's possible to change XML mappings