1

我正在使用 ReSharper 和 StyleCop 来强加一些命名约定。我有一个类名以大写开头的规则。但是,在某些类中,我需要违反规则(当命名直接从我的数据库映射的类时,我希望它们具有表、视图等的名称,我们的约定是以小写开头的t_名称表,v_供查看)。

我正在使用该[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter"]属性抑制警告。它在一堂课上效果很好。它没有在另一个。这两个类都是部分类。在这两种情况下,我都使用相同的属性和相同的消息。但在一种情况下,我仍然可以看到 ReSharper 抱怨。

这种抑制有效:

[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed. The name of the class resembles the name of the table in the database.")]
public partial class v_All_w_Status
{
    // ..
}

这不会:

[SuppressMessage("StyleCop.CShrp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed. The name of the class resembles the name of the table in the database.")]
public partial class t_Programs
{
    // ..
}

我尝试再次删除和添加抑制,但行为没有改变。显然,我错过了一些东西,但我看不到什么。任何帮助高度赞赏。

解决了:

在第二种情况下,有一个拼写错误:它说CShrp而不是CSharp.

4

0 回答 0