/// <summary> /// Creates an in-memory database and updates it with all available upgrade scripts /// <p>IMPORTANT: Remember to close out the database when finished!!</p> /// </summary> public static InMemorySQLiteDatabase CreateInMemoryDb() { var log = new Mock <ILog>(); var db = new InMemorySQLiteDatabase(); DbHelper.UpgradeSQLiteFile(db.ConnectionString, log.Object); return(db); }
static void Main() { using (var database = new TemporarySQLiteDatabase("test")) { database.Create(); var upgrader = DeployChanges.To .SQLiteDatabase(database.ConnectionString) .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) .LogToConsole() .Build(); var watch = new Stopwatch(); watch.Start(); var result = upgrader.PerformUpgrade(); watch.Stop(); Display("File", result, watch.Elapsed); } // Database will be deleted at this point using (var database = new InMemorySQLiteDatabase()) { var upgrader = DeployChanges.To .SQLiteDatabase(database.ConnectionString) .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) .LogToConsole() .Build(); var watch = new Stopwatch(); watch.Start(); var result = upgrader.PerformUpgrade(); watch.Stop(); Display("InMemory", result, watch.Elapsed); } // Database will disappear from memory at this point }