public void UpdateDatabase() { var rm = new EmbeddedResourceManager(); if (IsEmptyDatabase()) { //Build first tables var script = "Probel.Lanceur.SQLiteDb.Assets.Scripts.ddl.sql"; _logger.Info($"Create first tables. Applying script '{script}'"); rm.ReadResourceAsString(script, content => ExecuteScript(content)); } if (!HasTableSettings()) { var script = "Probel.Lanceur.SQLiteDb.Assets.Scripts.update-0.1.sql"; _logger.Info($"Table 'settings' does not exist. Applying script '{script}'"); rm.ReadResourceAsString(script, content => ExecuteScript(content)); } new UpdateManager(_connectionString, _logger).Update(); }
private void Execute(string value, DbConnection conn) { _resManager.ReadResourceAsString(value, sql => conn.Execute(sql)); }