Assuming we have a List of filters, is it ok to use Parallel.ForEach to make async calls and then use them? Must we have to wait for all calls to end? What if we have 3 async calls and one fails/times out?
var results = new ConcurrentBag<Service>();
Parallel.ForEach(filters, async filter =>
{
var result = await serviceClient.GetAllAsync(filter).ConfigureAwait(false);
results.AddRange(result);
});
MyMapper.Map(results);
where MyMapper has a method:
Map(IEnumerable<Service> services) {
foreach(Service service in services) {
//do stuff
}
}