I have an internal NuGet package that wraps a 3rd party NuGet package which in turn wraps an API. My internal wrapper handles authentication and a few other convenience elements.
The wrapped package includes typed namespaces - Wrapped.Package.V1.* - and updates fairly frequently. Right now, we have to update the NuGet package on all of the apps that use the wrapper (which will necessarily continue to happen), but we also have to spend "busy work" time updating all of the using statements through out the dependent apps.
I'm looking for something that my wrapper package can offer so that the dependent apps don't have to hit all the usings, and will just see compiler errors if the underlying package changes signatures that they rely on.
That is: I'd like my wrapper package to provide something like a Wrapper.WrappedPackage.Current.* set of namespaces that automagically point to the version of the wrapped package that my wrapper wraps.
It's okay if this is an opt-in thing on the part of the dependent apps. I'm not trying to hide anything, just remove some of the busywork.
Writing a code generator to emit a shim is a possibility, but a daunting one; I'm hoping that there's something a bit more maintainable.
I'd prefer something that automagically handles modifications to the namespaces, but having to do a little copy-pasta (or write a generator that does some magic for the namespaces themselves without having to shim all of the classes) would work, too.
I've tried Googling around this, but "using" and "proxy" are ... rather general terms (lots of hits for proxying HTTP requests), so the results have been disappointing.
Based on the comments, I feel I need to clarify a bit.
I have a base package that exposes half a dozen namespaces, each of which have possibly dozens of descendants (mostly classes). Specifically, Wrapped.Namespace.V1.*. Consumers of my package might use any of those, some in a using static context (eg., Wrapped.Namespace.V1.Enums; it's not uncommon to add using static Wrapped.Namespace.V1.Enums.TypeEnum alongside several related enums).
What I would like to do is add something in my wrapper package that "hides" Wrapped.Namespace.V1 behind Consonto.WrappedCurrent so that consumers of my package can add using Consonto.WrappedCurrent.X or using static Consonto.WrappedCurrent.Enums.TypeEnum, that WrappedCurrent will always refer to the current version that the package is wrapping.
Or, replace
using Wrapped.Namespace.V1.X;
using static Wrapped.Namespace.V1.Enums.TypeEnum;
using Example = Wrapped.Namespace.V1.Bar;
with
using Consonto.WrappedCurrent.X;
using static Consonto.WrappedCurrent.Enums.TypeEnum;
using Example = Consonto.WrappedCurrent.Bar;
I fully recognize that upgrading a consumer might still require further modification when the underlying package's contracts change radically; I'm just trying to reduce the busy-work of having to upgrade the NuGet package and running a global find-and-replace of Wrapped.Namespace.V1. to Wrapped.Namespace.V2. (then having to remember that one weird place that needs to be updated to "V2" but doesn't use the full namespace for some reason).
global usingso that you can update it in one place. (More extensive = more feasible. You don't want aglobal usingfor a rarely-imported namespace.) Individual usings are redundant but not an error, so you can remove those progressively leading up to the first update of theglobal usingif you don't want to do it all at once.using statics, which would be desirable. Basically, I want to be able to do a one-time global find-and-replace for "Wrapped.Stuff.V1" to "Consonto.WrappedStuff.Current" and have the only "V1" reference anywhere in the codebase live in my wrapper.global using static, as well.