Recommended url structure for parent child list in mvc
If I am listing child items of a parent in an 开发者_JS百科asp.net mvc app, is there a best practice to how the url structure should be formed?
Example:
1. http://app/parent/<parentID>/children
2. http://app/parent/children/<parentID>
I'm personally more inclined to choose option 1, but am wondering if there is a particular way that most mvc apps go with.
Also, assuming option 1, how would one use the Html.ActionLink method in the parent view to build up the link? I can build the link for option 2 easy enough using:
<%=Html.ActionLink("Child List", "Children", new { id = Model.ID })%>
Not sure about best practices but I will opt for option 1 too.
Perhaps "parents" with an 's':
http://app/parents/<parentID>/children
Option 2 just doesn't seem right/logical to me.
精彩评论