Using Routing in Orchard

Topics: Core, Customizing Orchard, General
Aug 25, 2013 at 1:48 AM
Hi I would like to ask, how we can achieved Routes registration in Orchard like the one in MVC, where we have the defaults value.
        public static void RegisterRoutes(RouteCollection routes)

        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
Thanks.
Aug 25, 2013 at 11:08 AM
Take a look at the source code and look for files called "Routes.cs".
Almost every module has one.

Very similar to MVC routes:
namespace Orchard.MultiTenancy {
    public class Routes : IRouteProvider {
        public IEnumerable<RouteDescriptor> GetRoutes() {
            return new[] {
                             new RouteDescriptor {
                                                     Route = new Route(
                                                         "Admin/MultiTenancy/Edit/{name}",
                                                         new RouteValueDictionary {
                                                                                      {"area", "Orchard.MultiTenancy"},
                                                                                      {"controller", "Admin"},
                                                                                      {"action", "Edit"}
                                                                                  },
                                                         new RouteValueDictionary {
                                                                                      {"name", ".+"}
                                                                                  },
                                                         new RouteValueDictionary {
                                                                                      {"area", "Orchard.MultiTenancy"}
                                                                                  },
                                                         new MvcRouteHandler())
                                                 }
                         };
        }