diff --git a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs index 28b6c9567e..5430f20155 100644 --- a/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Abstractions/Volo/Abp/EventBus/IEventBus.cs @@ -163,4 +163,4 @@ public interface IEventBus /// /// Name of the event void UnsubscribeAll(string eventName); -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs index e613502018..0004bce24b 100644 --- a/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Azure/Volo/Abp/EventBus/Azure/AzureDistributedEventBus.cs @@ -426,14 +426,14 @@ public class AzureDistributedEventBus : DistributedEventBusBase, ISingletonDepen protected override IEnumerable GetDynamicHandlerFactories(string eventName) { - var result = new List(); - var eventType = GetEventTypeByEventName(eventName); if (eventType != null) { - result.AddRange(GetHandlerFactories(eventType)); + return GetHandlerFactories(eventType); } + var result = new List(); + foreach (var handlerFactory in DynamicHandlerFactories.Where(hf => hf.Key == eventName)) { result.Add(new EventTypeWithEventHandlerFactories(typeof(DynamicEventData), handlerFactory.Value)); diff --git a/framework/src/Volo.Abp.EventBus.Dapr/Volo/Abp/EventBus/Dapr/DaprDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Dapr/Volo/Abp/EventBus/Dapr/DaprDistributedEventBus.cs index 37e34d864b..3f4f1780db 100644 --- a/framework/src/Volo.Abp.EventBus.Dapr/Volo/Abp/EventBus/Dapr/DaprDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Dapr/Volo/Abp/EventBus/Dapr/DaprDistributedEventBus.cs @@ -358,14 +358,14 @@ public class DaprDistributedEventBus : DistributedEventBusBase, ISingletonDepend protected override IEnumerable GetDynamicHandlerFactories(string eventName) { - var result = new List(); - var eventType = GetEventTypeByEventName(eventName); if (eventType != null) { - result.AddRange(GetHandlerFactories(eventType)); + return GetHandlerFactories(eventType); } + var result = new List(); + foreach (var handlerFactory in DynamicHandlerFactories.Where(hf => hf.Key == eventName)) { result.Add(new EventTypeWithEventHandlerFactories(typeof(DynamicEventData), handlerFactory.Value)); diff --git a/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs index ff7f9f6816..792442aa06 100644 --- a/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Kafka/Volo/Abp/EventBus/Kafka/KafkaDistributedEventBus.cs @@ -459,14 +459,14 @@ public class KafkaDistributedEventBus : DistributedEventBusBase, ISingletonDepen protected override IEnumerable GetDynamicHandlerFactories(string eventName) { - var result = new List(); - var eventType = GetEventTypeByEventName(eventName); if (eventType != null) { - result.AddRange(GetHandlerFactories(eventType)); + return GetHandlerFactories(eventType); } + var result = new List(); + foreach (var handlerFactory in DynamicHandlerFactories.Where(hf => hf.Key == eventName)) { result.Add(new EventTypeWithEventHandlerFactories(typeof(DynamicEventData), handlerFactory.Value)); diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs index 52c0de77c9..f192eeda4b 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs @@ -418,14 +418,14 @@ public class RebusDistributedEventBus : DistributedEventBusBase, ISingletonDepen protected override IEnumerable GetDynamicHandlerFactories(string eventName) { - var result = new List(); - var eventType = GetEventTypeByEventName(eventName); if (eventType != null) { - result.AddRange(GetHandlerFactories(eventType)); + return GetHandlerFactories(eventType); } + var result = new List(); + foreach (var handlerFactory in DynamicHandlerFactories.Where(hf => hf.Key == eventName)) { result.Add(new EventTypeWithEventHandlerFactories(typeof(DynamicEventData), handlerFactory.Value)); diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventHandlerFactoryUnregistrar.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventHandlerFactoryUnregistrar.cs index cd5c7b74f6..ffbf14d25f 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventHandlerFactoryUnregistrar.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventHandlerFactoryUnregistrar.cs @@ -44,4 +44,4 @@ public class DynamicEventHandlerFactoryUnregistrar : IDisposable { _eventBus.Unsubscribe(_eventName, _factory); } -} \ No newline at end of file +}