Skip to content

Roundhouserefreshdatabasefnh

ferventcoder edited this page Jun 19, 2011 · 30 revisions

RoundhousE + NHibernate == Rebuild Your Database without leaving Visual Studio!

Set up

  1. Create a console application
  2. Make it x86.
  3. Use NuGet to install roundhouse.refreshdatabase.fnh.
  4. Set the start up program to RefreshDatabase.Main().
  5. Add a project reference to your application's DLL that has the Fluent Mappings (and/or HBMs)
  6. OPTIONAL: Add a project reference to your application's DLL that has the conventions (could be the same as the step above).
  7. Set up the following code:
private static bool _isThisInitialDevelopment = true;
private static string _nameOfInitialScript = "0001_CreateTables_NH.sql";
private static string _nameOfUpdateScript = "0002_AlterTables_NH.sql";
//roundhouse information
private static string _databaseName = "__REPLACE__";
private static string _pathToSqlScripts = @"..\..\..\__REPLACE__";
private static string _repositoryPath = "__REPLACE__";
//restore 
private static bool _restoreDuringMaintenance = true;
private static string _pathToRestore = @"\\__REPLACE__.bak";
//Note: Add a reference to the project that has the Mappings/Conventions
private static string _mappingsAssemblyPath = @".\__REPLACE__.dll";
private static string _conventionsAssemblyPath = @".\__REPLACE__.dll";
  1. Then right click on the project and select Debug -> Start.
Clone this wiki locally