开发者

ASP.NET MVC Files names underscore

There is a naming convention to use underscore prefix for views which are not accessed directly (partial view, layouts, etc.) in ASP.NET MVC razor. I am not sure whether I should to use this prefix for view which is acc开发者_如何学Cessed only from child action.


No, you should not. As you said, prefixes are used by convention for views not accessed directly. But if child action has view, it means it IS accessed, so prefixing that view name with underscore would mean breaking another convention (more robust and conventional one :)) - naming views according to action names. So don't prefix them, or you will have to explicitly specify view name in child action.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜