コード例 #1
0
        protected override Type GetControllerType(RequestContext requestContext, string controllerName)
        {
            if (controllerName == null)
            {
                return(base.GetControllerType(requestContext, controllerName));
            }
            string area = requestContext.RouteData.GetAreaName();

            var serviceKey = ControllerConventionalRegistrar.GetControllerSerivceName(area, controllerName) + "Controller";

            object instance = default(object);

            if (string.IsNullOrEmpty(area) || !_iocManager.IsRegistered(serviceKey))
            {
                return(base.GetControllerType(requestContext, controllerName));
            }
            return(_iocManager.GetHandlerType(serviceKey));
        }