风格指南/布局 web.config 的最佳方式app.config 以获得持续支持
配置文件变得如此复杂,以至于有些人认为它们是 他们自己的编程语言。如果我要进一步进行这个类比,那么在编辑文件时保持一些一致性是有意义的。
我打算将这个问题限制在 WCF 上,它对最小的配置更改非常敏感,但认为其他部分(web.config)也将从结构中受益。
鉴于 VS2010 将处理文件的缩进,更新配置文件时还适用哪些其他标准?我想到的一些想法:
- 按字母顺序对
进行排序
中的名称标识符应该被推到左侧
或者
- 组标识符和 < 不同专业(Web、WCF、身份模型)之间的指导可能略有不同,但我很乐意听到您自己的观点。
我猜测
Config files have grown so complex that some have suggested that they are their own programming language. If I were to take this analogy further, it would make sense to have some consistencies when editing the file.
I was going to limit this question to WCF, which is very sensitive to the smallest configuration change, but think other sections (web.config) would benefit from a structure as well.
Given that VS2010 will handle the indentation of the file, what other standards are applicable when updating a config file? Some ideas I came up with :
- Sort
<config sections>
alphabetically - The name identifier within
<config sections/>
should be pushed to the left
Alternatively
- Group identifiers and
config sections
by similar function
I'm guessing the guidance may vary slightly between specialties (Web vs WCF vs identity model) but I'd appreciate hearing your own perspective.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我总是(直到有相反的情况发生)按字母顺序对所有内容(节、节点、子节点)进行排序,节的声明除外,它必须先进行。
I always (until something forces the opposite) sort everything alphabetically (sections, nodes, subnodes), except sections' declaration, which have to going first.