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; } }
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(); } }
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(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { _connection?.Close(); _connection = null; } _isDisposed = true; }
protected virtual void Dispose(bool disposing) { if (!disposing || _isDisposed) { return; } _connection?.Close(); _connection = null; _isDisposed = true; }
public void CloseConnection() { writeConnection?.Close(); writeConnection?.Dispose(); writeConnection = null; GC.Collect(); Task.Delay(100).Wait(); }
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( ); } }
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; }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { baseConnection?.Close(); baseConnection?.Dispose(); } disposed = true; } }
/// <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; }
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); }
public void DeleteDatabase() { var path = GetDatabasePath(); try { _conn?.Close(); } catch { } if (File.Exists(path)) { File.Delete(path); } _conn = null; }
public void Stop() { _db.Close(); _db = null; }