public static Route CreateRouteEx(this WebFormRouteHandler handler, string url, object defaults, object constraints, object dataTokens)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            var route = new RouteEx(url, handler);

            route.Defaults    = new RouteValueDictionary(defaults);
            route.Constraints = new RouteValueDictionary(constraints);
            route.DataTokens  = new RouteValueDictionary(dataTokens);
            return(route);
        }
Beispiel #2
0
        public static Route CreateRouteEx(this MvcRouteHandler handler, string url, object defaults, object constraints, object dataTokens, string[] namespaces)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            var route = new RouteEx(url, handler);

            route.Defaults    = new RouteValueDictionary(defaults);
            route.Constraints = new RouteValueDictionary(constraints);
            route.DataTokens  = new RouteValueDictionary(dataTokens);
            if (namespaces != null && namespaces.Length > 0)
            {
                route.DataTokens["Namespaces"] = namespaces;
            }
            return(route);
        }
        public static Route MapRouteEx(this RouteCollection routes, string name, string url, object defaults, object constraints, object dataTokens, string[] namespaces)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            var route = new RouteEx(url, new MvcRouteHandler());

            route.Defaults    = new RouteValueDictionary(defaults);
            route.Constraints = new RouteValueDictionary(constraints);
            route.DataTokens  = new RouteValueDictionary(dataTokens);
            if (namespaces != null && namespaces.Length > 0)
            {
                route.DataTokens["Namespaces"] = namespaces;
            }
            routes.Add(name, route);
            return(route);
        }