NotificationService.cs 820 B

1234567891011121314151617181920212223242526
  1. using GreenTree.Nachtragsmanagement.Core.Plugins;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace GreenTree.Nachtragsmanagement.Services.Misc
  8. {
  9. public class NotificationService : INotificationService
  10. {
  11. /// <summary>
  12. /// Searches for all implementations of the INotificationPlugin
  13. /// </summary>
  14. public IEnumerable<INotificationPlugin> GetNotificationPlugins()
  15. {
  16. var type = typeof(INotificationPlugin);
  17. var types = AppDomain.CurrentDomain.GetAssemblies()
  18. .SelectMany(s => s.GetTypes())
  19. .Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
  20. .OfType<INotificationPlugin>();
  21. return types;
  22. }
  23. }
  24. }