Robin Kaltenbach
Robin Kaltenbach

Reputation: 178

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. But I couldn't solve the problem that ReSharper checks every class and marks every class that has not a Dto in its name.

Can I create conditional rules that are only triggered on actual DTOs?

Upvotes: 1

Views: 758

Answers (1)

aybe
aybe

Reputation: 16652

The best thing to do in your case would be simply the following:

Add another rule with the DTO suffix

enter image description here

enter image description here

enter image description here

Now R# is happy again as if nothing happened.

Alternatively, you can turn these warnings off in different ways:

Add the abbreviation to team-shared settings

enter image description here

Use SuppressMessage

[SuppressMessage("ReSharper", "InconsistentNaming")]
class WhateverDTO
{
    
}    

Upvotes: 2

Related Questions