示例#1
0
        public ApiControllerInfo RegisterControllerType(Type controllerType, string routePrefix = null)
        {
            var info = new ApiControllerInfo(null, controllerType, routePrefix);

            ControllerInfos.Add(info);
            return(info);
        }
示例#2
0
        public void RegisterController(object instance, string routePrefix = null)
        {
            Util.Check(instance != null, "Controller instance may not be null.");
            var controllerType = instance.GetType();

            //Check if it is a mistake - user is registering controller type; if yes, redirect to other method
            if (typeof(Type).GetTypeInfo().IsAssignableFrom(controllerType.GetTypeInfo()))
            {
                RegisterControllerType((Type)instance, routePrefix);
                return;
            }
            var info = new ApiControllerInfo(instance, controllerType, routePrefix);

            ControllerInfos.Add(info);
        }