From 91226ece1b9203529d509149eecdb26956b8b752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 24 Mar 2020 14:36:30 +0300 Subject: [PATCH] Created ExceptionSubscriber. --- .../Abp/DependencyInjection/ExposedServiceExplorer.cs | 4 ++-- .../Volo/Abp/ExceptionHandling/ExceptionSubscriber.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionSubscriber.cs diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs index cb0d727795..cf4befae5b 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ExposedServiceExplorer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; namespace Volo.Abp.DependencyInjection { @@ -17,10 +16,11 @@ namespace Volo.Abp.DependencyInjection public static List GetExposedServices(Type type) { return type - .GetCustomAttributes() + .GetCustomAttributes(true) .OfType() .DefaultIfEmpty(DefaultExposeServicesAttribute) .SelectMany(p => p.GetExposedServiceTypes(type)) + .Distinct() .ToList(); } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionSubscriber.cs b/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionSubscriber.cs new file mode 100644 index 0000000000..5f2971c8c4 --- /dev/null +++ b/framework/src/Volo.Abp.Core/Volo/Abp/ExceptionHandling/ExceptionSubscriber.cs @@ -0,0 +1,11 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.ExceptionHandling +{ + [ExposeServices(typeof(IExceptionSubscriber))] + public abstract class ExceptionSubscriber : IExceptionSubscriber, ITransientDependency + { + public abstract Task HandleAsync(ExceptionNotificationContext context); + } +} \ No newline at end of file