What should go into the top level namespace?
Depends on classes.
One recommendation I'm trying to make is that the dependencies between namespaces shouldn't follow a loop. In other words, lower-level namespaces cannot access types from higher-level namespaces.
This means that the top-level MyAPI namespace must contain:
- High-level code: code to view MyAPI.WebLogic and MyAPI.Compression
- Or low-level code: code used by MyAPI.WebLogic and / or MyAPI.Compression
Patrick Smacchia has written extensively about the benefits of structuring your code this way, including on this site: Dependencies Between Namespaces in .NET
a source to share
You are not breaking encapsulation at all as far as I can see it. In fact, I'm not even sure if this can be called encapsulation, given that namespaces are not specific to OOP - most likely it is just an orgsynthesis of types.
The rule is to just put the type in the top level namespace if you believe it belongs. A prime example for this situation is that (using your examples) MyAPI.WebLogic and MyAPI.Compression (probably as well as others) should all use a specific type - so it's best to put that type in MyAPI. If you're still not quite sure what belongs, use the Microsoft libraries as examples. There are many classes in the namespace System
in BCL!
a source to share