行动和观点约定的命名(重新审视)
我是 MVC 的新手,作为学习练习,我正在尝试将旧应用程序重写为 ASP.NET MVC 应用程序。 我对问题操作命名约定仅部分涵盖的一些约定有点不清楚。
假设我有两个控制器:JobController 和 ClientController。 两个控制器将具有相同的操作:列表、详细信息、新建、更新和删除。
这些操作的视图是否应该与操作命名相同? 在这种情况下,JobController 的列表操作应该有一个名为“List.aspx”的视图,而不是“JobList.aspx”之类的视图。
我想到这个问题的原因是我不确定拥有相同名称的多个视图(例如“List.aspx”)是否合适。 当我继续添加控制器时,这将变得越来越相关,因为系统中几乎每个业务对象都需要某种“List.aspx”。
I'm brand new to MVC and, as a learning exercise, I'm trying to re-write an old application as an ASP.NET MVC application. I'm a little unclear about some conventions which the question Action Naming Conventions only partially covers.
Lets say I have two controllers: JobController and ClientController. Both of the controllers are going to have identical actions: List, Details, New, Update, and Delete.
Should the views for these actions be named identically to the action? In this case the List action for JobController should have a view named "List.aspx" as opposed to something like "JobList.aspx".
The reason this question came to my mind was that I was unsure if its appropriate to have multiple views with the same name (such as "List.aspx"). This will get more and more relavent as I continue adding controllers as pretty much every business object in my system will require a "List.aspx" of some sort.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
他们不会真的有相同的名字。 如果为所有文件指定不同的名称很重要,为什么我们需要文件夹? 您实际上有一个 Job/List.aspx 和一个 Client/List.aspx。
They won't really have the same name. If it were important to give all our files different names why would we want folders? You actually have a Job/List.aspx and a Client/List.aspx.