hopefully not a horribly foolish refactoring
This commit is contained in:
parent
59d660165f
commit
1ecaf64dea
82 changed files with 782 additions and 398 deletions
|
@ -1,34 +0,0 @@
|
|||
using System.Collections.Immutable;
|
||||
using System.Reflection;
|
||||
using Femto.Common.Attributes;
|
||||
using MediatR;
|
||||
|
||||
namespace Femto.Modules.Blog.Contracts;
|
||||
|
||||
public static class Module
|
||||
{
|
||||
public static IDictionary<string, Type> GetIntegrationEventTypes()
|
||||
{
|
||||
var mapping = new Dictionary<string, Type>();
|
||||
|
||||
var types = typeof(Module).Assembly.GetTypes();
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
if (!typeof(INotification).IsAssignableFrom(type) || type.IsAbstract || type.IsInterface)
|
||||
continue;
|
||||
|
||||
var attribute = type.GetCustomAttribute<EventTypeAttribute>();
|
||||
if (attribute == null)
|
||||
continue;
|
||||
|
||||
var eventName = attribute.Name;
|
||||
if (!string.IsNullOrWhiteSpace(eventName))
|
||||
{
|
||||
mapping.TryAdd(eventName, type);
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue