My client is upgrading from WSS 3.0 to SharePoint 2010 (yes, I know the year is 2014, but baby steps). I am migrating my custom solutions to work in in 2010. My current issue is the way SharePoint 2010 handles namespaces.
Microsoft introduced the concept of namespaces with the .NET Framework in 2002. It is a good system to organize classes, and allows for identical class names from different libraries in the same application. For example:
The "WebPart" class belongs to the System.Web.UI.WebControls.WebParts namespace. So, to inherit a WebPart class, the full name is System.Web.UI.WebControls.WebParts.WebPart.
So for all of my web parts for company ABC, I use a namespace heirarchy like this:
ABC.WebParts - The root namespace. ABC.WebParts.Sites - All classes that belong to the Sites library (feature). ABC.WebParts.Sites.SiteLinks - The full path to the SiteLinks web part in the Sites feature.
Now, with SharePoint 2010 in Visual Studio 2012, when I create a new web part, the class is added to the namespace! For example:
ABC.WebParts - The root namespace. ABC.WebParts.Sites - All classes that belong to the Sites library (feature). ABC.WebParts.Sites.SiteLinks - The namespace for the SiteLinks web part. ONLY the SiteLinks web part! ABC.WebParts.Sites.SiteLinks.SiteLinks - The full path to the SiteLinks web part in the Sites feature.
This namespace is referenced in MULTIPLE locations; the .cs file, .xml files, .webpart files, etc. throughout the feature.
For a comparison, if you think of classes and namespaces as a phone number with area code, where you used to have the phone number (757) 555-1212, your phone number is suddenly (757-555-1212) 555-1212, and there are no other phone numbers in the (757-555-1212) area code but yours. It makes no sense.
So, I have two choices: (1) Accept that this is the way things have to work, or (2) find every instance of namespace referenced and change it to the correct way - the way namespaces have worked since 2002.
Am I wrong here? Am I missing something? Have other developers run into this issue?