I’m not really sure how to express this, but one pattern I often see in RoR apps is something like this:
/Post/postid/Comment/commentid
or
/Project/projectid/Tasks/taskid
Essentially in the model since a Project has Tasks you can access the TaskController from within a project resource.
Now I have started using the SimplyRestfulRouting from MVCContrib with ASP.NET MVC, so I have the following format:
Route => Action
/{Controller} => Index()
/{Controller}/{id} => Show()
I won’t get into all the details, anyone can google SimplyRestfulRouting to see. I am wondering if there is a consistent way to then allow:
/{Controller}/{id}/{Controller}/{id} type syntax.
Obviously it would be ideal if this was a convention over configuration style rather than just setting up lots of routes.
I have found the answer and it is Steve Hodgekiss’ Restful Routes. It is much more flexible than the one that comes with MVCContrib and allows for the sort of thing I am talking about and much, much more.
http://stevehodgkiss.com/2009/10/11/restful-routes-for-asp-net-mvc.html