From 9473d245a0ebde584c555513011ab1bce343d622 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Mon, 21 Aug 2017 21:05:13 +0800 Subject: [PATCH] fixed consumer method add to DI exception. (#38) --- src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs index f4ca93f..06b8249 100644 --- a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs +++ b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs @@ -67,13 +67,15 @@ namespace Microsoft.Extensions.DependencyInjection private static void AddSubscribeServices(IServiceCollection services) { - var consumerListenerServices = new Dictionary(); + var consumerListenerServices = new List>(); foreach (var rejectedServices in services) { if (rejectedServices.ImplementationType != null && typeof(ICapSubscribe).IsAssignableFrom(rejectedServices.ImplementationType)) - - consumerListenerServices.Add(typeof(ICapSubscribe), rejectedServices.ImplementationType); + { + consumerListenerServices.Add(new KeyValuePair(typeof(ICapSubscribe), + rejectedServices.ImplementationType)); + } } foreach (var service in consumerListenerServices)