[英]ReSharper C# Naming Convention for DTOs
I try to customize the naming rule for classes that when I see or create a DTO that the name is actually FooDTO
and not FooDto
.我尝试自定义类的命名规则,当我看到或创建名称实际上是
FooDTO
而不是FooDto
的 DTO 时。 But I couldn't solve the problem that ReSharper checks every class and marks every class that has not a Dto in its name.但是我无法解决 ReSharper 检查每个 class 并标记每个名称中没有 Dto 的 class 的问题。
Can I create conditional rules that are only triggered on actual DTOs?我可以创建仅在实际 DTO 上触发的条件规则吗?
The best thing to do in your case would be simply the following:在您的情况下,最好的办法就是:
Add another rule with the DTO suffix
添加另一个带有 DTO 后缀的规则
Now R# is happy again as if nothing happened.现在R#又开心起来了,好像什么都没发生过一样。
Alternatively, you can turn these warnings off in different ways:或者,您可以通过不同的方式关闭这些警告:
Add the abbreviation to team-shared settings
将缩写添加到团队共享设置
Use
SuppressMessage
使用
SuppressMessage
[SuppressMessage("ReSharper", "InconsistentNaming")]
class WhateverDTO
{
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.