Пример #1
0
        IMonoRailConfiguration ObtainConfiguration(HttpApplication appInstance)
        {
            IMonoRailConfiguration config = MonoRailConfiguration.GetConfig();
            MethodInfo             method = appInstance.GetType().GetMethod("MonoRail_Configure");

            if (method != null)
            {
                config = config ?? new MonoRailConfiguration();

                if (method.IsStatic)
                {
                    method.Invoke(null, new object[] { config });
                }
                else
                {
                    method.Invoke(appInstance, new object[] { config });
                }
            }

            if (config == null)
            {
                throw new ApplicationException("You have to provide a small configuration to use MonoRail. This can be done using the web.config or your global asax (your class that extends HttpApplication) through the method MonoRail_Configure(IMonoRailConfiguration config). Check the samples or the documentation.");
            }

            return(config);
        }
Пример #2
0
        /*----------------------------------------------------------------------------------------*/
        #region Public Methods
        /// <summary>
        /// Initializes the controller factory by searching the configured assemblies for defined controllers.
        /// </summary>
        public void Initialize()
        {
            IMonoRailConfiguration config = MonoRailConfiguration.GetConfig();

            if (config != null)
            {
                foreach (string assembly in config.ControllersConfig.Assemblies)
                {
                    Inspect(assembly);
                }
            }
        }
Пример #3
0
        private IMonoRailConfiguration ObtainConfiguration(HttpApplication appInstance)
        {
            IMonoRailConfiguration config = MonoRailConfiguration.GetConfig();

            var events = appInstance as IMonoRailConfigurationEvents;

            if (events != null)
            {
                config = config ?? new MonoRailConfiguration();

                events.Configure(config);
            }

            if (config == null)
            {
                throw new ApplicationException("You have to provide a small configuration to use " +
                                               "MonoRail. This can be done using the web.config or " +
                                               "your global asax (your class that extends HttpApplication) " +
                                               "through the method MonoRail_Configure(IMonoRailConfiguration config). " +
                                               "Check the samples or the documentation.");
            }

            return(config);
        }
Пример #4
0
        /// <summary>
        /// Initializes a module and prepares it to handle requests.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpApplication"></see> that provides access to the methods, properties, and events common to all application objects within an ASP.NET application</param>
        public void Init(HttpApplication context)
        {
            context.BeginRequest += OnBeginRequest;

            routingRules = MonoRailConfiguration.GetConfig().RoutingRules;
        }
Пример #5
0
        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(OnBeginRequest);

            routingRules = MonoRailConfiguration.GetConfig().RoutingRules;
        }