nhibernateidentitysequencehilo

Is there a practical way of migrating from identity columns to hilo keys?


I work with a database that depends heavily on identity columns. However as we have now moved all applications over to NHibernate I wanted to look into using HiLo as seems to be recommended with NHibernate. Are there any strategies to do this, or any common problems to watch out for?


Solution

  • If this is a question about migrating an existing application to hilos which previously used auto ids, and has old data in it which needs to be migrated... then this would be my best bet (not tried it though! - comments welcome!) :

    If course this only addresses issues with the identity column, not anything else in your schema that might need to change if you are moving an app to NHibernate.