How can one change the primary key using NHibernate.
        Posted  
        
            by mark
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mark
        
        
        
        Published on 2010-05-01T14:04:32Z
        Indexed on 
            2010/05/01
            22:17 UTC
        
        
        Read the original article
        Hit count: 240
        
nhibernate
Dear ladies and sirs.
I want to change the primary key of an entity in database, so that all the relevant foreign key constraints are updated as well./We are using NHibenate as our ORM.
Is it possible to do it?
Thanks.
P.S.
I know the practice of changing the primary key is highly discouraged. My problem is that my primary key is backed by a natural Id of the entity, which may sometimes change. We could, theoretically, utilize a unique primary key, unrelated to the natural key of the entity, but this complicates things too much in other places, so this is not an option.
© Stack Overflow or respective owner