public static LocalDB Create(string fullPath) { LocalDB ldb = new LocalDB(fullPath, SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite | SQLite.SQLiteOpenFlags.FullMutex); ldb.BeginTransaction(); try { LocalState.Configuration conf = new LocalState.Configuration(); conf.Version = LocalDBVersion; ldb.InsertSafe(conf); ldb.Commit(); return(ldb); } catch (Exception e) { ldb.Rollback(); ldb.Dispose(); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } throw new Exception("Couldn't create database!", e); } }
public static LocalDB Create(string fullPath) { LocalDB ldb = new LocalDB(fullPath, SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite | SQLite.SQLiteOpenFlags.FullMutex); ldb.BeginTransaction(); try { LocalState.Configuration conf = new LocalState.Configuration(); conf.Version = LocalDBVersion; ldb.InsertSafe(conf); ldb.Commit(); return ldb; } catch (Exception e) { ldb.Rollback(); ldb.Dispose(); if (System.IO.File.Exists(fullPath)) System.IO.File.Delete(fullPath); throw new Exception("Couldn't create database!", e); } }