Parcourir la source

fixed .net core 2.0 services resolve bug

master
Savorboard il y a 7 ans
Parent
révision
756935abfb
1 fichiers modifiés avec 14 ajouts et 10 suppressions
  1. +14
    -10
      src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs

+ 14
- 10
src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs Voir le fichier

@@ -48,19 +48,23 @@ namespace DotNetCore.CAP.Internal
IServiceProvider provider)
{
var executorDescriptorList = new List<ConsumerExecutorDescriptor>();

var consumerServices = provider.GetServices<ICapSubscribe>();
foreach (var service in consumerServices)
using (var scoped = provider.CreateScope())
{
var typeInfo = service.GetType().GetTypeInfo();
if (!typeof(ICapSubscribe).GetTypeInfo().IsAssignableFrom(typeInfo))
var scopedProvider = scoped.ServiceProvider;
var consumerServices = scopedProvider.GetServices<ICapSubscribe>();
foreach (var service in consumerServices)
{
continue;
}
var typeInfo = service.GetType().GetTypeInfo();
if (!typeof(ICapSubscribe).GetTypeInfo().IsAssignableFrom(typeInfo))
{
continue;
}

executorDescriptorList.AddRange(GetTopicAttributesDescription(typeInfo));
executorDescriptorList.AddRange(GetTopicAttributesDescription(typeInfo));
}
return executorDescriptorList;
}
return executorDescriptorList;
}

private static IEnumerable<ConsumerExecutorDescriptor> FindConsumersFromControllerTypes(
@@ -76,7 +80,7 @@ namespace DotNetCore.CAP.Internal
{
executorDescriptorList.AddRange(GetTopicAttributesDescription(typeInfo));
}
}
}

return executorDescriptorList;
}


Chargement…
Annuler
Enregistrer