开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜