public static void InitTable(string databasePath) { SQLiteConnection sqliteConn = new SQLiteConnection(DBCommand.GetConnectionString(databasePath)); try { sqliteConn.Open(); SQLiteTransaction sqliteTrans = sqliteConn.BeginTransaction(); DBMatrix3d.CreateTable(sqliteConn); DBPoint3D.CreateTable(sqliteConn); DBInsertPoint.CreateTable(sqliteConn); DBFixtureDetails.CreateTable(sqliteConn); DBFixtureBeingUsedArea.CreateTable(sqliteConn); DBDwgFile.CreateTable(sqliteConn); DBTable.CreateTable(sqliteConn); DBFixture_Unit.CreateTable(sqliteConn); DBAreaBorder.CreateTable(sqliteConn); if (projectElement.P_NOTE != null) { projectElement.P_NOTE.WriteToDatabase(sqliteConn); } if (projectElement.Dwgs != null) { foreach (DwgFileModel model in projectElement.Dwgs) { model.WriteToDatabase(sqliteConn); } } sqliteTrans.Commit(); sqliteTrans.Dispose(); sqliteConn.Close(); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { DebugMessage(string.Format(@"Error opening Database: {0}, Error:{1}", databasePath, e.Message)); } }
public static SQLiteConnection OpenSqliteConnection(string dbPath) { return(new SQLiteConnection(DBCommand.GetConnectionString(dbPath))); }