nhibernateormfluent-nhibernatechange-management

Where should I put my NHibernate SchemaExport method?


Where should I put my NHibernate SchemaExport method and how should I call it when I decide to recreate the database?

Should I leave this in my startup project (an asp.net mvc project)? Should I create a seperate console project just for exporting my schema?

I think these questions all originate from the fact that I don't want schema export to run every time the web app starts.

I'm using fluent nhibernate if that makes a difference.


Solution

  • I would factor this out into a seperate assembly; you could then use this from a variety of places (console app, integration test setup, installer, etc).