• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

How do you handle namespace conflicts?

I use fxcop and one of the violations is to use an existing .NET namespace such as Configuration, ConfigurationManager, Security.  I like the rule.  It avoids namespace conflicts.  But what are some other names to give those spaces?  How are others naming them?
0
brettr
Asked:
brettr
  • 5
  • 2
  • 2
2 Solutions
 
williamcampbellCommented:
You can have a global namespace for you product or company

namespace bretterscoolcode.configuration
{
}

namespace okcompany.bretteriscooler.code.configuration
{
}

Use the dots luke ..

0
 
p_davisCommented:
How about prefixing the names with your applications name?
0
 
brettrAuthor Commented:
Using dots like thecompany.Enterprise.Configuration makes no difference.  fxcop will even point out the fully qualified namespace is incorrect:

Error, Certainty 95, for TypeNamesShouldNotMatchNamespaces
{
    Target       : mycompany.Enterprise.Configuration  (IntrospectionTargetType)
    Resolution   : "The type name 'Configuration' conflicts in whole
                   or in part with the namespace name 'System.Configuration'
                   defined in the .NET Framework. Rename the type to eliminate
                   the conflict."
    Help         : http://msdn2.microsoft.com/ms182257(VS.90).aspx  (String)
    Category     : Microsoft.Naming  (String)
    CheckId      : CA1724  (String)
    RuleFile     : Naming Rules  (String)
    Info         : "Identifiers which conflict in whole or in part with
                   namespace names should be avoided. Names that describe
                   the purpose or contents of a type are preferred."
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
p_davisCommented:
i meant like if your application was called MyApp

you can do MyAppSecurity
0
 
p_davisCommented:
or use acronyms

MASecurity
0
 
brettrAuthor Commented:
I was referring to williamcampbell.  I don't want to use the company name or acronums of it in the namespace.  Cheesy.
0
 
p_davisCommented:
You asked for suggestions, i gave one. I don't think there is a reason to make fun of a suggestion that is perfectly valid.
0
 
williamcampbellCommented:
Go into fxcop and turn of this warning ... it's stupid in my opioion

mmm cheese

0
 
p_davisCommented:
that's it, now i am hungry.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now