I have different types of providers. This providers supplying data from different sources. Also i have a table in the database in which i can find provider to use for specific team.
Team 1 - "FirstProvider"
Team 2 - "SecondProvider" and so on.
Depending on the team i want to use appropriate provider to get specific data for the team.
string providerType = ...
IProvider provider;
if(providerType == "FirstProvider")
{
provider = new FirstProvider();
}
else if(providerType == "SecondProvider")
{
provider = new FirstProvider;
}
What is the best patter/way of doing this? Maybe some objects factory...
Aucun commentaire:
Enregistrer un commentaire