protected virtual void Dispose(bool disposing) { if (disposing) { _db.Dispose(); File.Delete(_databasePath); } }
protected virtual void Dispose(bool disposing) { if (disposing) { _db.Dispose(); File.Delete(_connectionString.Filename); } }
public async Task TestCanDisposeDatabaseTimely() { string databasePath = Path.Combine(Path.GetTempPath(), "litedbn-async-testing-" + Path.GetRandomFileName() + ".db"); var db = new LiteDatabaseAsync(databasePath); // Ensure to do some stuff to open the database var collection = db.GetCollection <SimplePerson>(); await collection.InsertAsync(new SimplePerson()).ConfigureAwait(false); var stopwatch = Stopwatch.StartNew(); db.Dispose(); stopwatch.Stop(); Assert.InRange(stopwatch.Elapsed.TotalSeconds, 0, 4.99); }
protected virtual void Dispose(bool disposing) { if (!disposing || _disposed) { return; } try { _db.Dispose(); File.Delete(_databasePath); } finally { _disposed = true; } }
public void Dispose() { _db?.Dispose(); }
public void Dispose() { _database.Dispose(); _tempFile.Dispose(); }