private async Task<Dictionary<string, List<string>>> FindFromToAll()
{
try
{
_mutex.WaitOne();
if (_fromToAll.Count > 0)
{
return _fromToAll;
}
foreach (var serviceType in FindAllServiceTypes())
{
var service = ActivatorUtilities.CreateInstance(provider, serviceType);
var fromTo = await service.Invoke<Task<List<string>>>("FromTo");
_fromToAll.Add(serviceType.Name.Replace("Service", null), fromTo);
}
return _fromToAll;
}
finally
{
_mutex.ReleaseMutex();
}
}
private async Task<Dictionary<string, List<string>>> FindFromToAll()
{
try
{
_mutex.WaitOne();
if (_fromToAll.Count > 0)
{
return _fromToAll;
}
foreach (var serviceType in FindAllServiceTypes())
{
var service = ActivatorUtilities.CreateInstance(provider, serviceType);
var fromTo = await service.Invoke<Task<List<string>>>("FromTo");
_fromToAll.Add(serviceType.Name.Replace("Service", null), fromTo);
}
return _fromToAll;
}
finally
{
_mutex.ReleaseMutex();
}
}