Init
This commit is contained in:
1 parent
a73338916a
commit
fbc1cc8d3e
207 files changed
+10327
-2
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Code.Infrastructure.EventBus
|
||||
{
|
||||
internal static class EventBusHelper
|
||||
{
|
||||
private static Dictionary<Type, List<Type>> s_CashedSubscriberTypes =
|
||||
new();
|
||||
|
||||
public static List<Type> GetSubscriberTypes(
|
||||
IGlobalSubscriber globalSubscriber)
|
||||
{
|
||||
Type type = globalSubscriber.GetType();
|
||||
if (s_CashedSubscriberTypes.ContainsKey(type))
|
||||
{
|
||||
return s_CashedSubscriberTypes[type];
|
||||
}
|
||||
|
||||
List<Type> subscriberTypes = type
|
||||
.GetInterfaces()
|
||||
.Where(t => t.GetInterfaces()
|
||||
.Contains(typeof(IGlobalSubscriber)))
|
||||
.ToList();
|
||||
|
||||
s_CashedSubscriberTypes[type] = subscriberTypes;
|
||||
return subscriberTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user