?
Solved

How do you handle namespace conflicts?

Posted on 2009-04-10
9
Medium Priority
?
308 Views
Last Modified: 2012-05-06
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
Comment
Question by:brettr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 12

Accepted Solution

by:
williamcampbell earned 1000 total points
ID: 24117931
You can have a global namespace for you product or company

namespace bretterscoolcode.configuration
{
}

namespace okcompany.bretteriscooler.code.configuration
{
}

Use the dots luke ..

0
 
LVL 22

Assisted Solution

by:p_davis
p_davis earned 1000 total points
ID: 24117934
How about prefixing the names with your applications name?
0
 

Author Comment

by:brettr
ID: 24118006
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 22

Expert Comment

by:p_davis
ID: 24118024
i meant like if your application was called MyApp

you can do MyAppSecurity
0
 
LVL 22

Expert Comment

by:p_davis
ID: 24118026
or use acronyms

MASecurity
0
 

Author Comment

by:brettr
ID: 24118145
I was referring to williamcampbell.  I don't want to use the company name or acronums of it in the namespace.  Cheesy.
0
 
LVL 22

Expert Comment

by:p_davis
ID: 24118172
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
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24118243
Go into fxcop and turn of this warning ... it's stupid in my opioion

mmm cheese

0
 
LVL 22

Expert Comment

by:p_davis
ID: 24118260
that's it, now i am hungry.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question