Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 730
myermian Avatar asked Jul 14 '11 21:07

myermian


2 Answers

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. :(

like image 162
TrueWill Avatar answered Oct 14 '22 09:10

TrueWill


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

like image 36
ChrisWue Avatar answered Oct 14 '22 10:10

ChrisWue