Search code examples
sql-serverwinformsnhibernatecastle-activerecord

How to update schema in SQL Server database using Active Records and nhibernate?


I have winforms application which uses nhibernate and active records to access the database. My question is how do I update the database schema through the application? The CreateSchema method deletes the database and creates a new one. Is there anyway to update just few parts of the database through some method.


Solution

  • You can use schemaupdate, providing you have the configuration

     public void CanUpdateDatabase()
        {
            SchemaUpdate su = new SchemaUpdate(config);
            su.Execute(true, true);
        }
    

    it works depending on the db dialect ( in my experience works well with MSSQL+Oracle )