| 12345678910111213141516171819202122232425262728293031 |
- using GreenTree.Nachtragsmanagement.Core.Plugins;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
- namespace GreenTree.Nachtragsmanagement.Services.Misc
- {
- public class NotificationService : INotificationService
- {
- /// <summary>
- /// Searches for all implementations of the INotificationPlugin
- /// </summary>
- public IEnumerable<INotificationPlugin> GetNotificationPlugins()
- {
- var type = typeof(INotificationPlugin);
- var assemblies = AppDomain.CurrentDomain.GetAssemblies();
- var types = assemblies
- .SelectMany(p => p.GetTypes())
- .Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
- .Select(p => Activator.CreateInstance(p))
- .OfType<INotificationPlugin>()
- .ToList();
- return types;
- }
- }
- }
|