Example #1
0
        /// <summary>
        /// Initialization of all ActionHandlers
        ///
        /// By using reflection, this method scans the /bin folder for components which implements the
        /// IActionHandler interface.
        /// </summary>
        private static void registerActionHandlers()
        {
            string _pluginFolder = GlobalSettings.Path + "/../bin";

            HttpContext.Current.Trace.Write("action.factory", "Adding actions from directory: " + HttpContext.Current.Server.MapPath(_pluginFolder));

            string[] types = TypeResolver.GetAssignablesFromType <IActionHandler>(
                HttpContext.Current.Server.MapPath(_pluginFolder), "*.dll");
            foreach (string type in types)
            {
                Type           t            = Type.GetType(type);
                IActionHandler typeInstance = Activator.CreateInstance(t) as IActionHandler;
                if (typeInstance == null)
                {
                    continue;
                }
                _actionHandlers.Add(typeInstance);
                if (HttpContext.Current != null)
                {
                    HttpContext.Current.Trace.Write("FindActionHandlers", " + Adding actionhandler '" + typeInstance.HandlerName());
                }
            }
        }