public static Database InitDatabase(string databaseFile, IHelperLogger logger) { Database db; if (!File.Exists(databaseFile)) { SQLiteConnection.CreateFile(databaseFile); db = new Database(GetConnectionString(databaseFile), providerName: "System.Data.SQLite"); try { db.BeginTransaction(); db.Execute(RuntimeTableSQLite.CreateSQLScript); db.Execute(PrivateCards.Site.SiteCardsTableAdapter.CreateSQLScript); db.Execute(PrivateCards.Note.NoteCardsTableAdapter.CreateSQLScript); db.Execute(PrivateCards.Device.DeviceCardsTableAdapter.CreateSQLScript); db.Execute(PrivateCards.DataBase.DatabaseCardsTableAdapter.CreateSQLScript); db.Execute(PrivateCards.CreditCard.CreditCardsTableAdapter.CreateSQLScript); db.CompleteTransaction(); } catch// (Exception) { db.AbortTransaction(); throw; } } else { db = new Database(GetConnectionString(databaseFile), providerName: "System.Data.SQLite"); } return(db); }
public static bool UpdateDB(Database db, int currentDbVersion, IHelperLogger logger) { //try //{ // db.BeginTransaction(); // db.CompleteTransaction(); //} //catch (Exception ex) //{ // db.AbortTransaction(); // return false; //} return(true); }