I have an application that uses providers. Each provider has their own class and all use the same interface. I have a function written called Load_Data that works now using one specific provider (hardcoded in function). Now I need to update the code so that the user can choose what provider he wants to use.
1) I would like to pass the specific provider to the Load_Data class, then i could remove the provider instantiation that is in the Load_Data function and make the same function call. I would like to call the Load_Data(IProvider provider), but not sure how to choose a specific provider based on user choice.
2) I keep the call to Load_Data like it is, nothing passed and then user reflection to get an instance of the provider chosen by the user. But since this is a Win7 Phone application not sure I want the overhead of reflecting.
Any help on how to do the ideas above or other option I might have would be appreciated.
View Complete Post