Skip to content

Instantly share code, notes, and snippets.

@StacyGay
Created July 13, 2014 20:35
Show Gist options
  • Save StacyGay/416ac6a22565dc245772 to your computer and use it in GitHub Desktop.
Save StacyGay/416ac6a22565dc245772 to your computer and use it in GitHub Desktop.
Client loop example
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