Пример #1
0
        public IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
        {
            //get spring context
            WebApplicationContext ctx = ContextRegistry.GetContext() as WebApplicationContext;
            string controller         = controllerName + "Controller";

            //查找是否配置该Controller
            if (ctx.ContainsObject(controller))
            {
                object controllerf = ctx.GetObject(controller);
                return((IController)controllerf);
            }
            else
            {
                if (defalutf == null)
                {
                    defalutf = new DefaultControllerFactory();
                }

                return(defalutf.CreateController(requestContext, controllerName));
            }
        }