Created
July 13, 2014 20:35
-
-
Save StacyGay/416ac6a22565dc245772 to your computer and use it in GitHub Desktop.
Client loop example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClientConfigLoop | |
{ | |
private readonly IClientConfigRepo _configRepo; | |
private readonly InterfaceFactory _interfaceFactory; | |
public ClientConfigLoop(IClientConfigRepo configRepo, InterfaceFactory interfaceFactory) | |
{ | |
_interfaceFactory = interfaceFactory; | |
_configRepo = configRepo; | |
} | |
public void Task(Config config) | |
{ | |
var factoryInstance = _interfaceFactory.GetNewFactoryInstance(config); | |
var service = factoryInstance.GetService<IBusinessLogicService>(); | |
Console.WriteLine(service.DoSomething(5)); | |
} | |
public void ExecuteTask() | |
{ | |
var clients = _configRepo.GetClients(); | |
clients.ForEach(Task); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment