Here are the examples of the csharp api class System.Data.Common.DbConnection.Close() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
0
2. Example
View licensepublic override void Close() { if (myThread != null) myThread.Abort(); if (myDBConn != null) myDBConn.Close(); }
0
3. Example
View licensepublic override void Close() { if (myThread != null) myThread.Abort(); if (myDBConn != null) myDBConn.Close(); }
0
4. Example
View licensepublic override void Close() { if (myThread != null) myThread.Abort(); if (myDBConn != null) myDBConn.Close(); }
0
5. Example
View licensepublic override void Close() { if (myThread != null) myThread.Abort(); if (myDBConn != null) myDBConn.Close(); }
0
6. Example
View licensepublic virtual void Dispose(bool disposing) { if (_disposed) return; if (disposing) { // free other managed objects that implement // IDisposable only try { if (_objectContext != null && _objectContext.Connection.State == ConnectionState.Open) { _objectContext.Connection.Close(); } } catch (ObjectDisposedException) { // do nothing, the objectContext has already been disposed } if (_dataContext != null) { _dataContext.Dispose(); _dataContext = null; } } // release any unmanaged objects // set the object references to null _disposed = true; }
0
7. Example
View licensepublic void Close() { if (dbConnection != null) { dbConnection.Close(); dbConnection = null; dbProviderFactory = null; } }
0
8. Example
View licensepublic void Close() { if (dbConnection != null) { dbConnection.Close(); dbConnection = null; dbProviderFactory = null; } }
0
0
0
11. Example
View licensepublic static void CloseAllDbContexts() { foreach (DbContext ctx in _storage.GetAllDbContexts()) { if (((IObjectContextAdapter)ctx).ObjectContext.Connection.State == System.Data.ConnectionState.Open) ((IObjectContextAdapter)ctx).ObjectContext.Connection.Close(); } }
0
12. Example
View licensepublic static void CloseAllObjectContexts() { foreach (ObjectContext ctx in Storage.GetAllObjectContexts()) { if (ctx.Connection.State == System.Data.ConnectionState.Open) ctx.Connection.Close(); } }
0
13. Example
View license[TestFixtureTearDown] public void TearDown() { if ((context != null) && (((IObjectContextAdapter)context).ObjectContext.Connection.State == System.Data.ConnectionState.Open)) { ((IObjectContextAdapter)context).ObjectContext.Connection.Close(); context = null; } }
0
14. Example
View license[TestFixtureTearDown] public void TearDown() { if ((context != null) && (((IObjectContextAdapter)context).ObjectContext.Connection.State == System.Data.ConnectionState.Open)) { ((IObjectContextAdapter)context).ObjectContext.Connection.Close(); context = null; } }
0
15. Example
View license[TestFixtureTearDown] public void TearDown() { if ((context != null) && (context.Connection.State == System.Data.ConnectionState.Open)) { context.Connection.Close(); context = null; } }
0
16. Example
View licensepublic static void CloseAllDbContexts() { foreach (DbContext ctx in _storage.GetAllDbContexts()) { if (((IObjectContextAdapter)ctx).ObjectContext.Connection.State == System.Data.ConnectionState.Open) ((IObjectContextAdapter)ctx).ObjectContext.Connection.Close(); } }
0
17. Example
View license[TestCleanup] public void TearDown() { if ((context != null) && (((IObjectContextAdapter)context).ObjectContext.Connection.State == System.Data.ConnectionState.Open)) { ((IObjectContextAdapter)context).ObjectContext.Connection.Close(); context = null; } }
0
18. Example
View license[TestCleanup] public void TearDown() { if ((context != null) && (((IObjectContextAdapter)context).ObjectContext.Connection.State == System.Data.ConnectionState.Open)) { ((IObjectContextAdapter)context).ObjectContext.Connection.Close(); context = null; } }
0
19. Example
View licensepublic static DbCommand Close(this DbCommand Command) { if (Command != null && Command.Connection != null && Command.Connection.State != ConnectionState.Closed) Command.Connection.Close(); return Command; }
0
20. Example
View licensepublic static DbCommand Close(this DbCommand Command) { if (Command != null && Command.Connection != null && Command.Connection.State != ConnectionState.Closed) Command.Connection.Close(); return Command; }
0
21. Example
View licensepublic void SqlCloseConnection() { connection.Close(); permanent_connection = false; }
0
0
23. Example
View licenseprotected virtual void Dispose( bool disposing ) { if( this.disposed == false ) { if( disposing ) { this.connection.Close(); } } this.disposed = true; }
0
0
0
0
27. Example
View licenseinternal void close(bool isQueue) { if (queue == null || isQueue) { if (connection != null) { //connection.setAutoCommit(true); connection.Close(); connection = null; } } }
0
28. Example
View licenseprivate void tryClose() { try { if (reader != null) { reader.Close(); reader = null; } } catch (Exception ex) { WeedConfig.logException(null, ex); }; try { if (conn != null) { conn.Close(); conn = null; } } catch (Exception ex) { WeedConfig.logException(null, ex); }; }
0
29. Example
View licenseinternal void close(bool isQueue) { if (queue == null || isQueue) { if (connection != null) { //connection.setAutoCommit(true); connection.Close(); connection = null; } } }
0
30. Example
View licenseprivate void tryClose() { try { if (reader != null) { reader.Close(); reader = null; } } catch (Exception ex) { WeedConfig.logException(null, ex); }; try { if (conn != null) { conn.Close(); conn = null; } } catch (Exception ex) { WeedConfig.logException(null, ex); }; }
0
0
32. Example
View licenseinternal void Disconnect() { if (_connection.State == System.Data.ConnectionState.Open) _connection.Close(); connectionStatus.Text = "Disconnected"; }
0
33. Example
View licensepublic void Dispose() { var cn = _connection; _connection = null; try { cn?.Close(); } catch { /* throwing from Dispose() is so lame */ } }
0
34. Example
View licenseprotected void Dispose(bool disposing) { if (disposing) { // dispose managed resources Connection.Close(); } }
0
0
36. Example
View licensepublic virtual void CloseConnection() { if (Connection.State != ConnectionState.Closed) { Connection.Close(); _explicitlyOpened = false; } }
0
0
0
39. Example
View licensepublic virtual void ReleaseConnection(DbConnection connection) { if (connection != null && connection.State == ConnectionState.Open) { try { connection.Close(); _diagnosticService.Emit(new SQLEventBuilder(this, SQLEventType.ConnectionClosed) { ConnectionName = _connectionStringSettings.Name }.Build()); } catch (Exception ex) { _diagnosticService.Emit(new SQLEventBuilder(this, SQLEventType.CommandError) { Detail = "Error closing connection", ConnectionName = _connectionStringSettings.Name, Exception = ex }.Build()); } } }
0
40. Example
View licenseprotected virtual void Dispose(bool disposing) { if (disposing) { try { _connection.Close(); } catch (Exception ex) { _diagnosticService.Emit(new SQLEventBuilder(this, SQLEventType.CommandError) { Detail = "Error closing singleton connection", ConnectionName = _connectionStringSettings.Name, Exception = ex }.Build()); } } }
0
41. Example
View licensepublic override void Close() { _profiler.ConnectionClosed(InnerConnection, NHProfilerContextProvider.GetLoggedDbConnection(InnerConnection)); InnerConnection.Close(); }
0
42. Example
View licensepublic void Close() { if (_connection != null) { _connection.Close(); } if (_results != null) { _results.Close(); } }
0
43. Example
View licensepublic void CloseConnection(DbConnection conn) { if (conn != null && conn.State != ConnectionState.Closed) try { conn.Close(); conn.Dispose(); } catch { } }
0
44. Example
View licensepublic void CloseConnection(DbConnection conn) { if (conn != null && conn.State != ConnectionState.Closed) try { conn.Close(); conn.Dispose(); } catch { } }
0
45. Example
View licensepublic void CloseConnection(DbConnection conn) { if (conn != null && conn.State != ConnectionState.Closed) try { conn.Close(); conn.Dispose(); } catch { } }
0
46. Example
View licensepublic static bool TestConnection( this DatabaseCommand databaseCommand ) { try { databaseCommand.DbCommand.Connection.Open(); databaseCommand.DbCommand.Connection.Close(); return true; } catch ( Exception ) { return false; } }
0
47. Example
View licensepublic static void CloseAndDispose( this DbCommand dbCommand ) { dbCommand.Connection.Close(); dbCommand.Connection.Dispose(); dbCommand.Dispose(); }
0
48. Example
View licensepublic void RollBack() { try { if (Command.Transaction != null) Command.Transaction.Rollback(); } finally { Command.Connection.Close(); } }
0
49. Example
View licensepublic void Commit() { try { if (Command.Transaction != null) Command.Transaction.Commit(); } finally { Command.Connection.Close(); } }
0
50. Example
View licenseprivate void CloseConnection() { if ((connection != null) && (connection.State != ConnectionState.Closed)) { connection.Close(); } RemoveInfoMessageHandler(); AutoClose = false; }