/// <summary> /// Will raise the event on the current thread synchronously. /// i.e. it will wait until all event handlers have processed the event. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. AfterLogUrlEventHandler eventHandler; if (!Monitor.TryEnter(afterLogUrlEventLock, lockTimeout)) { throw new ApplicationException("Timeout waiting for lock - RaiseOnAfterLogUrlEvent"); } try { eventHandler = afterLogUrlEvent; } finally { Monitor.Exit(afterLogUrlEventLock); } OnAfterLogUrlEvent(args); if (eventHandler != null) { eventHandler(this, args); } }
/// <summary> /// Raise log url event /// </summary> /// <param name="httpApplication">The httpApplication the request was raised on.</param> /// <param name="expression">The expression that matched the url.</param> internal void RaiseLogUrlEvent(HttpApplication httpApplication, string expression) { var beforeLogUrlEventArgs = new BeforeLogUrlEventArgs(httpApplication, expression); RaiseOnBeforeLogUrlEvent(beforeLogUrlEventArgs); if (beforeLogUrlEventArgs.Cancel) { return; } var logUrlEventArgs = new LogUrlEventArgs(httpApplication, expression); RaiseOnLogUrlEvent(logUrlEventArgs); var afterLogUrlEventArgs = new AfterLogUrlEventArgs(httpApplication, expression); RaiseOnAfterLogUrlEvent(afterLogUrlEventArgs); }
/// <summary> /// Will raise the event on the calling thread asynchronously. /// i.e. it will immediatly continue processing even though event /// handlers have not processed the event yet. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseAsynchronousOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { asyncOperation.Post(new SendOrPostCallback(AsynchronousOnAfterLogUrlEventRaised), args); }
private void OnAfterLogUrlEvent(AfterLogUrlEventArgs e) { // TODO: Implement default behaviour of OnAfterLogUrlEvent }
/// <summary> /// Will raise the event on the calling thread synchronously. /// i.e. it will wait until all event handlers have processed the event. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseCrossThreadOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { asyncOperation.SynchronizationContext.Send(new SendOrPostCallback(AsynchronousOnAfterLogUrlEventRaised), args); }
/// <summary> /// Raise log url event /// </summary> /// <param name="httpApplication">The httpApplication the request was raised on.</param> /// <param name="expression">The expression that matched the url.</param> private void RaiseLogUrlEvent(HttpApplication httpApplication, string expression) { var beforeLogUrlEventArgs = new BeforeLogUrlEventArgs(httpApplication, expression); RaiseOnBeforeLogUrlEvent(beforeLogUrlEventArgs); if (beforeLogUrlEventArgs.Cancel) return; var logUrlEventArgs = new LogUrlEventArgs(httpApplication, expression); RaiseOnLogUrlEvent(logUrlEventArgs); var afterLogUrlEventArgs = new AfterLogUrlEventArgs(httpApplication, expression); RaiseOnAfterLogUrlEvent(afterLogUrlEventArgs); }
/// <summary> /// Will raise the event on the current thread synchronously. /// i.e. it will wait until all event handlers have processed the event. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. AfterLogUrlEventHandler eventHandler; if (!Monitor.TryEnter(afterLogUrlEventLock, _lockTimeout)) { throw new ApplicationException("Timeout waiting for lock - RaiseOnAfterLogUrlEvent"); } try { eventHandler = afterLogUrlEvent; } finally { Monitor.Exit(afterLogUrlEventLock); } OnAfterLogUrlEvent(args); if (eventHandler != null) { eventHandler(this, args); } }
/// <summary> /// Will raise the event on the calling thread asynchronously. /// i.e. it will immediatly continue processing even though event /// handlers have not processed the event yet. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseAsynchronousOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { _asyncOperation.Post(new SendOrPostCallback(AsynchronousOnAfterLogUrlEventRaised), args); }
/// <summary> /// Will raise the event on the calling thread synchronously. /// i.e. it will wait until all event handlers have processed the event. /// </summary> /// <param name="args">The state to be passed to the event.</param> private void RaiseCrossThreadOnAfterLogUrlEvent(AfterLogUrlEventArgs args) { _asyncOperation.SynchronizationContext.Send(new SendOrPostCallback(AsynchronousOnAfterLogUrlEventRaised), args); }