private void StopListeningToRoute(Route route) { Debug.Write("Stopping route listener: "); Debug.Write(route.ToString()); Debug.Write(" ... "); foreach (var listenerkvp in TcpListeners) { var listener = listenerkvp.Value; try { listener.Stop(); } catch { } } if (ActiveSessions != null) { var sessionsToDispose = new List <RoutedSession>(ActiveSessions); foreach (IDisposable session in sessionsToDispose) { session.Dispose(); } ActiveSessions.Clear(); } }
/// <summary> /// Rollbacks transaction and closes database connection. /// </summary> protected override void DisposeUow() { foreach (ActiveTransactionInfo activeTransaction in ActiveTransactions.Values) { foreach (ISession session in activeTransaction.AttendedSessions) { session.Dispose(); } activeTransaction.Transaction.Dispose(); activeTransaction.StarterSession.Dispose(); } foreach (ISession activeSession in ActiveSessions.Values) { activeSession.Dispose(); } ActiveSessions.Clear(); ActiveTransactions.Clear(); }