I'm attempting to put a web service wrapper around several third-party web services. For the sake of this question, we'll work with two of them:
- OrderService
- AddressService
Both of these services have the same object defined in different namespaces:
- OrderService.AuthenticationParameters
- AddressService.AuthenticationParameters
I was hoping to be able to create a single base class that would be able to detect/switch between namespaces. For example:
public abstract class BaseLogic
{
internal BaseLogic()
{
/* Initialize authParams */
//Switch out / detect namespace here
this.authParams = new OrderService.AuthenticationParameters();
this.authParams.accountName = "[MyAccountName]";
this.authParams.userName = "[MyUserName]";
this.authParams.password = "[MyPassword]";
}
}
I've seen several similar questions. Either they don't apply to my situation, or I'm incapable of understanding them.
Question: Is what I'm trying to achieve possible? If it's possible, am I over complicating things?
Additional Info: Eventally, there will be more than two services that share this common object. The vendor provides a separate service URL for each branch of functionality they provide.
See Question&Answers more detail:os