Пример #1
0
        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);
        }
Пример #2
0
        /// <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);
        }