diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException.cs deleted file mode 100644 index 71dbafba06..0000000000 --- a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Volo.Abp.ExceptionHandling; - -namespace Volo.Abp.GlobalFeatures -{ - public class AbpGlobalFeatureNotEnableException : AbpException, IHasErrorCode - { - public string Code { get; } - - public AbpGlobalFeatureNotEnableException(string message = null, string code = null, Exception innerException = null) - : base(message, innerException) - { - Code = code; - } - - public AbpGlobalFeatureNotEnableException WithData(string name, object value) - { - Data[name] = value; - return this; - } - } -} diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnabledException.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnabledException.cs new file mode 100644 index 0000000000..d0f4be2c45 --- /dev/null +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnabledException.cs @@ -0,0 +1,23 @@ +using System; +using Volo.Abp.ExceptionHandling; + +namespace Volo.Abp.GlobalFeatures +{ + [Serializable] + public class AbpGlobalFeatureNotEnabledException : AbpException, IHasErrorCode + { + public string Code { get; } + + public AbpGlobalFeatureNotEnabledException(string message = null, string code = null, Exception innerException = null) + : base(message, innerException) + { + Code = code; + } + + public AbpGlobalFeatureNotEnabledException WithData(string name, object value) + { + Data[name] = value; + return this; + } + } +} diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs index a03ec7fa0e..4cc1a0bc01 100644 --- a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureHelper.cs @@ -5,9 +5,9 @@ namespace Volo.Abp.GlobalFeatures { public static class GlobalFeatureHelper { - public static bool IsGlobalFeatureEnabled(Type controllerType, out RequiresGlobalFeatureAttribute attribute) + public static bool IsGlobalFeatureEnabled(Type type, out RequiresGlobalFeatureAttribute attribute) { - attribute = ReflectionHelper.GetSingleAttributeOrDefault(controllerType); + attribute = ReflectionHelper.GetSingleAttributeOrDefault(type); return attribute == null || GlobalFeatureManager.Instance.IsEnabled(attribute.GetFeatureName()); } } diff --git a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs index e688e18661..649ddd2954 100644 --- a/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs +++ b/framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.GlobalFeatures if (!GlobalFeatureHelper.IsGlobalFeatureEnabled(invocation.TargetObject.GetType(), out var attribute)) { - throw new AbpGlobalFeatureNotEnableException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled) + throw new AbpGlobalFeatureNotEnabledException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled) .WithData("ServiceName", invocation.TargetObject.GetType().FullName) .WithData("GlobalFeatureName", attribute.Name); } diff --git a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs index 62c363ba39..c638f03d46 100644 --- a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs +++ b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/AbpGlobalFeatureNotEnableException_Localization_Test.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.GlobalFeatures { using (CultureHelper.Use("zh-Hans")) { - var exception = new AbpGlobalFeatureNotEnableException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled) + var exception = new AbpGlobalFeatureNotEnabledException(code: AbpGlobalFeatureErrorCodes.GlobalFeatureIsNotEnabled) .WithData("ServiceName", "MyService") .WithData("GlobalFeatureName", "TestFeature");; var errorInfo = _exceptionToErrorInfoConverter.Convert(exception, false); diff --git a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor_Tests.cs b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor_Tests.cs index a7e97fbf82..cd9d53444d 100644 --- a/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor_Tests.cs +++ b/framework/test/Volo.Abp.GlobalFeatures.Tests/Volo/Abp/GlobalFeatures/GlobalFeatureInterceptor_Tests.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.GlobalFeatures [Fact] public async Task Interceptor_Test() { - var ex = await Assert.ThrowsAsync(async () => + var ex = await Assert.ThrowsAsync(async () => { await _testAppServiceV1.TestMethod(); });