当前位置:  开发笔记 > 后端 > 正文

行动命名公约

如何解决《行动命名公约》经验,为你挑选了1个好方法。

有人在MVC中建立了良好的行动命名约定吗?我特别关注ASP.net MVC,但这是一个普遍的问题.例如,我有一个显示登录屏幕(Login)的操作和一个处理该页面登录请求的操作(LoginTest).我并不热衷于这些名字,我还有很多应用程序要写.



1> Paul Shannon..:

MS的Rob Conery为动作提出了一些有用的REST风格命名.

* Index - the main "landing" page. This is also the default endpoint.
* List - a list of whatever "thing" you're showing them - like a list of Products.
* Show - a particular item of whatever "thing" you're showing them (like a Product)
* Edit - an edit page for the "thing"
* New - a create page for the "thing"
* Create - creates a new "thing" (and saves it if you're using a DB)
* Update - updates the "thing"
* Delete - deletes the "thing"

导致网址(对于论坛)

* http://mysite/forum/group/list - shows all the groups in my forum
* http://mysite/forum/forums/show/1 - shows all the topics in forum id=1
* http://mysite/forums/topic/show/20 - shows all the posts for topic id=20

Rob Conery关于MVC的RESTful架构


链接死 - 有上Archive.org快照 - http://web.archive.org/web/20130119131317/http://wekeroad.com/2007/12/06/aspnet-mvc-using-restful-architecture
推荐阅读
云聪京初瑞子_617
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有