We are using an external vendor's dll to communicate with them as part of our application. This dll has a static class, which includes some properties that determine the account (credentials) that is used to connect to the vendor. However, our application needs to connect using two different accounts depending on the code path. This would be fine (we would just set the correct account right before each connection), but the problem is that we also need to have event handlers tied to the vendor's events (which are also on this static class) and the event handlers need to respond to events fired for each account. Having one copy of the static class means that only events from the currently connected account get picked up.
I know this is not a good design (if it were up to me, the vendor's class would be instantiated twice, once for each account), but we don't have control over how the vendor designed their dll and they are not going to change it.
It seems like the only way to have event handlers watch for events for both accounts is to have two copies of our application, but that's really ugly. Is there any way to somehow have two copies of the dll referenced from our project? Or any other way to solve this issue?