public void ChangeSQLiteConnection(SQLiteConnection c, bool saveBefore = false) { if (saveBefore) { Commit(); } m_dbConnection?.Close(); m_dbConnection = c; m_dbCommand = new SQLiteCommand(c); m_dbContext = new DandDContext(c); }
/// <summary> /// The Constructor. Initialize the SQLite connection determined by a path file /// </summary> /// <param name="path">The SQLite string initializer. Can be a path via 'Data Source=path'.</param> public DBHandler(String path) { m_dbConnection = new SQLiteConnection(path); m_dbConnection.Open(); m_dbCommand = new SQLiteCommand(m_dbConnection) { CommandText = DB_INIT }; try { m_dbCommand.ExecuteNonQuery(); } catch (Exception) { } m_dbContext = new DandDContext(m_dbConnection); }