/// <summary> /// Disposes of the HTTP applications that was created as an entry point. /// </summary> private void DisposeHttpApplication() { HttpApplication httpApplication = this.httpApplication; this.httpApplication = null; if (httpApplication != null) { try { MethodInfo method = HttpApplicationProbe.FindExitPoint(httpApplication.GetType()); if (method != null) { this.logger.Info("Invoking exit point for HTTP application {0}.", httpApplication.GetType().FullName); this.InvokeEventHandler(httpApplication, method); } else { this.logger.Info("No exit point found for HTTP application {0}.", httpApplication.GetType().FullName); } } finally { httpApplication.Dispose(); } } }
/// <summary> /// Finds all types in the given assembly collection that implement <see cref="HttpApplication"/> /// and contain an entry or exit point (or both). /// </summary> /// <param name="assemblies">The assemblies to find application types for.</param> /// <returns>A collection of <see cref="HttpApplication"/> types.</returns> public static IEnumerable <Type> FindApplicationTypes(IEnumerable <Assembly> assemblies) { List <Type> result = new List <Type>(); foreach (Assembly assembly in assemblies ?? new Assembly[0]) { foreach (Type type in assembly.GetTypes().Where(t => HttpApplicationProbe.IsHttpApplication(t))) { if (HttpApplicationProbe.FindEntryPoint(type) != null || HttpApplicationProbe.FindExitPoint(type) != null) { result.Add(type); } } } return(result); }