Namespace naming

I had a problem trying to figure out how to properly name my namespace. Currently my namespace is:

<CompanyName>.<ProductName>.Configuration 

However, the use of "Config" conflicts with:

 System.Configuration 

To make matters worse, I also have a ConfigurationManager class. I know that I can change it to something like:

 <CompanyName>.<ProductName>.<ProductName>Configuration 

but it seems redundant. Any ideas?

EDIT: Also, I know that when I call any class, I can fully qualify the call code, but the frequency that the classes will use in the System.Configuration and <CompanyName>.<ProductName>.Configuration will do for the ugly code.

EDIT2: Providing Specifics:

Using operators:

 using System.Configuration; using SummitConfiguration = SST.Summit.Configuration; 

Problem line Configuration config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.PerUserRoamingAndLocal);

The error message "SST.Summit.Configuration" is a "namespace" but is used as a "type" (for the problem line above)

+4
source share
4 answers

Typically, in such cases, I leave the Configuration namespace and use an alias to access my namespace (and not the full qualification). For instance:

 using System.Configuration; using PC = MyCompany.MyProduct.Configuration; // ... string configValue = PC.ConfigurationManager.GetValue("Foo"); 
+11
source

How to do something like this:

 using System.Configuration; using MyCompany.MyProduct.ProdConfig 

or

 using System.Configuration; using MyCompany.MyProduct.Config 
+2
source

There should be no problem using the Configuration namespace - you just need to explicitly specify the one you want, fully giving the name. This is a bit of a pain, but I think a clear naming convention is better than coming up with a different name if the objects in your namespace really deal with the configuration. Like others, you can also use aliases.

+1
source

This may not work for you, but when I come across this, I just rename my namespace and / or class. Something like Config.ConfigManager.

0
source

All Articles