FindExitPoint() public static method

Finds a method acting as an HttpApplication exit point for the given type.
public static FindExitPoint ( Type type ) : MethodInfo
type System.Type The type to find the exit point for.
return System.Reflection.MethodInfo
Example #1
0
        /// <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();
                }
            }
        }
Example #2
0
        /// <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);
        }