protected void UpdateNotifyCacheInTransaction(ConnectionProvider objConnectionProvider) { try { NotifyCacheUpdate.CreateDBConnection = false; NotifyCacheUpdate notifyTbl = new NotifyCacheUpdate(_mainConnection); notifyTbl.MainConnectionProvider = objConnectionProvider; notifyTbl.daTimeStamp = DateTime.Now; notifyTbl.iID = 1; notifyTbl.Update(); } catch (Exception ex) { _log.Error("DBInteractionBase::UpdateNotifyCacheInTransaction : {0}", ex.Message); throw new Exception("DBInteractionBase::UpdateNotifyCacheInTransaction::Error occured." + ex.Message, ex); } finally { NotifyCacheUpdate.CreateDBConnection = true; } }
/// <summary> /// Purpose: Initializes class members. /// </summary> private void InitClass() { // create all the objects and initialize other members. _mainConnection = new SqlConnection(); _mainConnectionIsCreatedLocal = true; _mainConnectionProvider = null; // Set connection string of the sqlconnection object _mainConnection.ConnectionString = _strDBConnection; _errorCode = 0; _isDisposed = false; }
/// <summary> /// Purpose: Implements the Dispose functionality. /// </summary> protected virtual void Dispose(bool isDisposing) { // Check to see if Dispose has already been called. if (!_isDisposed) { if (isDisposing) { // Dispose managed resources. if (_mainConnectionIsCreatedLocal) { // Object is created in this class, so destroy it here. _mainConnection.Close(); _mainConnection.Dispose(); _mainConnectionIsCreatedLocal = false; } _mainConnectionProvider = null; _mainConnection = null; } } _isDisposed = true; }