protected void Application_EndRequest(object sender, EventArgs e) { if (CurrentContext != null) { CurrentContext.Dispose(); } }
public override void Dispose() { try { if (CurrentContext != null) { CurrentContext.Dispose(); } } catch { } try { if (CurrentObjectSet != null) { CurrentObjectSet = null; } } catch { } try { if (CurrentDbContext != null) { CurrentDbContext.Dispose(); } } catch { } }
public void Dispose() { if (CurrentSession != null) { CurrentSession.Logger.Information((ConsoleChannelName ?? "(AnonConsoleChannnelName)") + ": Dispose"); } if (ContextStack != null) { foreach (var ctx in ContextStack) { try { ctx.Dispose(); } catch { } } ContextStack = null; } if (CurrentContext != null) { try { CurrentContext.Dispose(); } catch { } CurrentContext = null; } GC.SuppressFinalize(this); }
public void PopContext() { if (ContextStack.Count > 0) { CurrentContext.Dispose(); CurrentContext = ContextStack.Pop(); NotifyMessage("コンテキストを変更しました。"); ShowCommandsAsUsers(); } }
/// <summary> /// コンソールを終了します。 /// </summary> public void Detach() { if (!IsAttached) { throw new InvalidOperationException("コンソールはアタッチされていません。"); } IsAttached = false; CurrentSession.PreMessageReceived -= new EventHandler <MessageReceivedEventArgs>(Session_PreMessageReceived); CurrentSession.PostMessageReceived -= new EventHandler <MessageReceivedEventArgs>(Session_PostMessageReceived); try { CurrentContext.Dispose(); } catch {} foreach (Context ctx in ContextStack) { try { ctx.Dispose(); } catch {} } CurrentContext = null; }
public void CloseDatabase() { CurrentContext.Dispose(); }