示例#1
0
        // TODO Review which methods can be changed to protected
        /// <summary>
        /// Determines the correct number of method parameters based on the given
        /// <see cref="MethodInfo" /> and returns an array filled with values from the given
        /// <see cref="RouteInfo" />.
        /// </summary>
        /// <param name="routeInfo"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        protected object[] GetActionMethodParameters(RouteInfo routeInfo, MethodInfo method)
        {
            var parameters       = new List <object>();
            var methodParameters = method.GetParameters();
            var parameterCount   = methodParameters.Length;
            var argCount         = routeInfo.ParameterValues.Count;

            if (methodParameters.Length > 0)
            {
                for (int i = 0; (i < argCount) && (i < parameterCount); i++)
                {
                    parameters.Add(routeInfo.ParameterValues[i]);
                }
            }

            return(parameters.ToArray());
        }
示例#2
0
        public static RouteInfo From(string areaName, string requestPath)
        {
            var routeInfo = new RouteInfo(areaName, requestPath);

            return(routeInfo.ParseRequestPath());
        }