ASP.NET MVC控制器命名多重化 [英] ASP.NET MVC Controller Naming Pluralization
问题描述
RESTful约定表示在单数对象上使用复数名词.
RESTful conventions indicate using plural nouns over singular objects.
命名ASP.NET MVC控制器的复数约定是什么,即
ProductController
或ProductsController
?
What is the pluralization convention for naming ASP.NET MVC controllers, i.e.
ProductController
or ProductsController
?
推荐答案
某些MVC框架使用复数形式,但是MVC项目模板包含一个称为AccountController的控制器,因此建议使用单数命名.
Some MVC Frameworks use plurals, however the MVC project templates contains a controller called AccountController thus suggesting singlular naming.
没关系.与Asp.net MVC框架中的大多数内容一样,您可以自己选择.没有真正的约定.
It doesn't matter. As with most things in the Asp.net MVC framework the choice is yours. There is no real conventions.
这是我个人的看法,但重要的是您选择一个方案并保持一致!
It's my personal opinion but what matters is that you pick a scheme and be consistent!
这篇关于ASP.NET MVC控制器命名多重化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!