Background:
I have a big solution where hundreds of functions take strongly typed collections as inparameters and using them as return values.
The solution references a generated proxy wich converts calls to a webservice that always returns collection in the format int[] or Order[] or wathever type it is. The proxy wraps them up as IntCollection or OrderCollection.
Now I want to reference the assembly directly. When I do that I get the interface against the Arrays instead of the proxy generated strongly typed collections. This of course breaks all the code.
I am looking for a smart way to handle this and avoid rewriting thousands lines of code.
Any ideas?
Does
IntCollectionetc belong to you? You could add an implicit conversion operator:Normally, this would be one of the times that interfaces (
IList<Foo>etc) help – but interfaces don’t often work very well in web services. Depending on what the code currently does, you might be able to do a ‘replace all’ fix – a bit drastic, though; other than that… you’re going to have to change odd bits of code.a few thoughts:
var(in C# 3.0) might minimize the change – i.e.var orders = svc.GetOrders(); in most cases, the different implementations will have ‘similar enough’ APIs.ToList(),.ToArray()) might serve as a shim