コード例 #1
0
        public static void MapRouteLowerCase(this RouteCollection routes, string name, string url, object defaults, object constraints)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }

            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            var route = new LowerCaseRoute(url, new MvcRouteHandler())
            {
                Defaults    = RouteValueDictionaryConvertor.Convert(defaults),
                Constraints = RouteValueDictionaryConvertor.Convert(constraints)
            };

            if (String.IsNullOrEmpty(name))
            {
                routes.Add(route);
            }
            else
            {
                routes.Add(name, route);
            }
        }
コード例 #2
0
        public static Route MapRouteLowerCase(this RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            LowerCaseRoute route = new LowerCaseRoute(url, new MvcRouteHandler())
            {
                Defaults    = CreateRouteValueDictionary(defaults),
                Constraints = CreateRouteValueDictionary(constraints),
                DataTokens  = new RouteValueDictionary()
            };

            if ((namespaces != null) && (namespaces.Length > 0))
            {
                route.DataTokens["Namespaces"] = namespaces;
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                routes.Add(route);
            }
            else
            {
                routes.Add(name, route);
            }

            return(route);
        }