public virtual void Close() { if (connection != null) { connection.Dispose(); } isInitialized = false; }
public virtual void Close() { if (connection != null) { connection.Dispose(); } hasVersion = false; hasErrors = false; error = null; isInitialized = false; }
protected virtual void Shrink() { if (FreeConnectionCount < shrinkSize) { return; } for (int i = 0; i < shrinkSize; i++) { if (HasFreeConnection) { lock (sync) { IPooledDbConnection conn = freeConnections.Dequeue(); conn.Dispose(); } } } }
protected virtual void TestClickedThreaded(object state) { DatabaseConnectionSettings settings = state as DatabaseConnectionSettings; DatabaseConnectionContext context = new DatabaseConnectionContext(settings); IDbFactory fac = DbFactoryService.GetDbFactory(settings.ProviderIdentifier); bool success = false; string error = null; FakeConnectionPool pool = null; IPooledDbConnection conn = null; try { pool = new FakeConnectionPool(fac, fac.ConnectionProvider, context); success = pool.Initialize(); error = pool.Error; } catch (System.Data.DataException ex) { error = ex.Message; success = false; } finally { if (conn != null) { conn.Release(); conn.Dispose(); } if (pool != null) { pool.Close(); } } DispatchService.GuiDispatch(delegate() { buttonTest.Sensitive = true; if (success) { labelTest.Text = AddinCatalog.GetString("Test Succeeded."); } else { labelTest.Text = AddinCatalog.GetString("Test Failed: {0}.", error); } }); }