Beispiel #1
0
        private Controller CreateController(Type controllerType)
        {
            Controller controller = null;

            if (controllerType != null)
            {
                controller = Container.Resolve(controllerType) as Controller;
                if (!(controller is DefaultController))
                {
                    throw new Exception("所有Controller必须继承DefaultController");
                }

                ActionInvokerRegistry actionInvokerRegistry = Container.Resolve <ActionInvokerRegistry>();
                Type actionInvokerType = actionInvokerRegistry.Matching(controllerType);
                controller.ActionInvoker    = Container.Resolve(actionInvokerType) as IActionInvoker;
                controller.TempDataProvider = new NullTempDataProvider();
            }

            return(controller);
        }
Beispiel #2
0
 protected abstract void Register(ActionInvokerRegistry registry);