I have two SSRS servers running identical configurations. Well, three, actually. Let's call them:
Now, I can easily swap between A and A-test depending on whether I'm in test or production using a web.config transform. So that's fine.
However, at runtime I'd like to be able to switch between sending calls to Server A and B.
I could potentially do this by creating two different ReportingService2010 objects: one with namespace com.company.serverA and the other with namespace com.company.serverB. It would require a lot of conditional statements, but it could be done.
I'd love to be able to use polymorphism and pass my ReportCopier class different ReportingService2010 objects, but they aren't closely enough related. The compiler treats them like totally separate objects.
Is there any way around this? Is there any way to dynamically change the URL the ReportingService2010 object is pointing to at runtime? Is there a way to deal with both kinds of objects by using reflection somehow?
Right now the only solutions I have is 1) implement wrapper classes for all the objects which seems tedious or 2) use two copies of ReportCopier class with only the namespace changed between them, which is ugly.
Thoughts?
This is by far the most boneheadedly easy solution I've found for a tricky problem: I can set the URL property. I was too busy worrying about inheritance to realize it.
ReportingService2010 rs = new ReportingService2010();
rs.Url = "https://serverA.company.com:443/ReportServer/ReportService2010.asmx";
// or...
rs.Url = "https://serverB.company.com:443/ReportServer/ReportService2010.asmx";