Пример #1
0
        public void DeleteDatabase()
        {
            try
            {
                var path = GetDatabasePath();

                try
                {
                    if (_conn != null)
                    {
                        _conn.Close();
                    }
                }
                catch
                {
                    // Best effort close. No need to worry if throws an exception
                }

                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                _conn = null;
            }
            catch
            {
                throw;
            }
        }
Пример #2
0
        public void CloseConnection()
        {
            if (_conn != null)
            {
                _conn.Close();
                _conn.Dispose();
                _conn = null;

                // Connection is not disposed of until garbage collector cleans up
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
Пример #3
0
        public void CloseConnection()
        {
            if (_conn != null)
            {
                _conn.Close();
                _conn.Dispose();
                _conn = null;

                // Must be called as the disposal of the connection is not released until the GC runs.
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
Пример #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _connection?.Close();
         _connection = null;
     }
     _isDisposed = true;
 }
Пример #5
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing || _isDisposed)
     {
         return;
     }
     _connection?.Close();
     _connection = null;
     _isDisposed = true;
 }
Пример #6
0
            public void CloseConnection()
            {
                writeConnection?.Close();
                writeConnection?.Dispose();
                writeConnection = null;

                GC.Collect();

                Task.Delay(100).Wait();
            }
Пример #7
0
 protected void Dispose(bool disposing)
 {
     if (_isDisposed || !disposing)
     {
         return;
     }
     _isDisposed = true;
     _connection?.Close();
     _connection = null;
 }
        public void CloseConnection()
        {
            if (_conn != null)
            {
                _conn.Close( );
                _conn.Dispose( );
                _conn = null;

                GC.Collect( );
                GC.WaitForPendingFinalizers( );
            }
        }
Пример #9
0
        public void DeleteDatabase()
        {
            var path = GetDatabasePath();

            try
            {
                if (_conn != null)
                {
                    _conn.Close();
                }
            }
            catch
            {
                //no hay que preocuparse si tira una exception
            }
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            _conn = null;
        }
Пример #10
0
 protected void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             baseConnection?.Close();
             baseConnection?.Dispose();
         }
         disposed = true;
     }
 }
Пример #11
0
 /// <summary>
 /// Close the connection
 /// </summary>
 public void ResetConnection()
 {
     App.WriteToLog($"ResetConnection1 {DateTime.Now.ToString("T")}");
     if (_Conn != null)
     {
         App.WriteToLog($"ResetConnection2 {DateTime.Now.ToString("T")}");
         _Conn.Close();
         _Conn.Dispose();
     }
     App.WriteToLog($"ResetConnection3 {DateTime.Now.ToString("T")}");
     _Conn = null;
 }
Пример #12
0
        public void DropDatabase()
        {
            if (conn != null)
            {
                conn.Rollback();
                conn.Close();
                conn.Dispose();
                conn = null;
            }

            FileSystem.FileManager fm = new FileSystem.FileManager();
            string path = GetDBPath();

            fm.DeleteFile(path);
        }
Пример #13
0
        public void DeleteDatabase()
        {
            var path = GetDatabasePath();

            try
            {
                _conn?.Close();
            }
            catch
            {
            }

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            _conn = null;
        }
Пример #14
0
 public void Stop()
 {
     _db.Close();
     _db = null;
 }