/* * // Do not call this method asynchronously as you will not be able to return feedback via cancel argument * /// <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="state">The state to be passed to the event.</param> * private void RaiseAsynchronousOnBeforeLogUrlEvent(BeforeLogUrlEventArgs args) * { * asyncOperation.Post(new SendOrPostCallback(AsynchronousOnBeforeLogUrlEventRaised), args); * } */ /// <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 RaiseOnBeforeLogUrlEvent(BeforeLogUrlEventArgs 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. BeforeLogUrlEventHandler eventHandler; if (!Monitor.TryEnter(beforeLogUrlEventLock, lockTimeout)) { throw new ApplicationException("Timeout waiting for lock - RaiseOnBeforeLogUrlEvent"); } try { eventHandler = beforeLogUrlEvent; } finally { Monitor.Exit(beforeLogUrlEventLock); } OnBeforeLogUrlEvent(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 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 RaiseCrossThreadOnBeforeLogUrlEvent(BeforeLogUrlEventArgs args) { asyncOperation.SynchronizationContext.Send(new SendOrPostCallback(AsynchronousOnBeforeLogUrlEventRaised), args); }
private void OnBeforeLogUrlEvent(BeforeLogUrlEventArgs e) { // TODO: Implement default behaviour of OnBeforeLogUrlEvent }
/// <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); }
/* // Do not call this method asynchronously as you will not be able to return feedback via cancel argument /// <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="state">The state to be passed to the event.</param> private void RaiseAsynchronousOnBeforeLogUrlEvent(BeforeLogUrlEventArgs args) { asyncOperation.Post(new SendOrPostCallback(AsynchronousOnBeforeLogUrlEventRaised), args); } */ /// <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 RaiseOnBeforeLogUrlEvent(BeforeLogUrlEventArgs 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. BeforeLogUrlEventHandler eventHandler; if (!Monitor.TryEnter(beforeLogUrlEventLock, _lockTimeout)) { throw new ApplicationException("Timeout waiting for lock - RaiseOnBeforeLogUrlEvent"); } try { eventHandler = beforeLogUrlEvent; } finally { Monitor.Exit(beforeLogUrlEventLock); } OnBeforeLogUrlEvent(args); if (eventHandler != null) { eventHandler(this, 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 RaiseCrossThreadOnBeforeLogUrlEvent(BeforeLogUrlEventArgs args) { _asyncOperation.SynchronizationContext.Send(new SendOrPostCallback(AsynchronousOnBeforeLogUrlEventRaised), args); }