tags:

views:

94

answers:

4

Is it possible to rename a namespace name in an existing API without breaking users code?

+4  A: 

no, it is not possible. The best you can is to rename namespace in single file: http://msdn.microsoft.com/en-us/library/sf0df423(VS.80).aspx

Andrey
+4  A: 

Is it possible to rename a namespace name in an existing API without breaking users code?

If you change the namespace an object is in, it will break the code that references it.

Kevin
+3  A: 

You could generate a bunch of objects in the old namespace that just delegate their calls to the new ones (transparent proxies in effect) and then deprecate the proxy objects at some point in the future.

Maybe pretty horrible depending on the size/complexity of your codebase though.

Better may simply be a non-technical answer of warning your users that an API namespace change is occuring in advance of it being released. Assuming they are actively developing the clients a search/replace is not the end of the world for them.

If there are significant numbers NOT actively developing clients then you'll have to continue a maintenance/bug-fix branch for a while with the old namespace.

Paolo
A: 

If you have access to the API callers code you can use an alias to reference to your new namespace.

This way, from the API caller perspective, no change has occurred.

Luis Filipe