【发布时间】:2015-09-02 20:59:13
【问题描述】:
在我们的 ASP.NET MVC 架构中,我们有以下路由结构:
http://localhost:80/Students/Details/2 - will give me details about student with id == 2, details include all the classes current student have.
http://localhost:80/Classes/Details/2 - will give me details about classes with id == 2, details include all the students current class have.
http://localhost:80/Schedule/Details/class=2&student=2 - will give me details about specific schedule for student with id=2 that has class with id=2
到目前为止,这工作正常。
现在,我们的团队对 asp.net mvc 还很陌生,我们正在考虑让路由更直观一些。因此,我们将有一条长路线,而不是三条单独的路线,如下所示:
http://localhost:80/Students/2/Classes/2/Homework/
它会像这样工作:
http://localhost:80/Students/ - will give list of students
http://localhost:80/Students/2 - will give details about student 2
http://localhost:80/Students/2/Classes - will give all the classes for student with id 2
http://localhost:80/Students/2/Classes/2 - will give schedule for class with id 2 and student with id 2.
不确定这是否合理/可能,只是想获得更多意见
【问题讨论】:
标签: asp.net asp.net-mvc routing asp.net-mvc-controller