简体   繁体   中英

CA1709 - Should we ignore this and use Db or DB?

I know it sounds silly, but in regards to CA1709 , should we ignore this error and just do what Microsoft did (which is use Db as the acronym for Database)?

Just wondering what people out there are doing. To me, it seems silly to use DB when Microsoft uses Db all over the place.

Quoting Brad Abrams in the excellent Framework Design Guidelines :

...I have heard every possible excuse for violating these naming guidelines. [...] For the most part, our customers have seen the places in which we have diverged from these guidelines (for even the best excuse) as warts in the Framework.

In other words, do as they say, not as they do. :)

Also, 'Db' is an abbreviation, not an acronym. Database is one word. Abbreviations should never be used in identifiers per the Guidelines. ('Id' is a special case.)

Sadly the CA1709 link lists 'DB' as an example. :(

It doesn't really matter, does it? Choose what you like best - but then make sure you use it consistently. With coding and naming conventions it's mainly about choosing one you like and be consistent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM