Browse Source

Also accept Name for RequiresGlobalFeatureAttribute.

pull/5163/head
Halil İbrahim Kalkan 6 years ago
parent
commit
d2af13fb1f
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
  2. 19
      framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/RequiresGlobalFeatureAttribute.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

@ -427,7 +427,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions
return true; return true;
} }
return GlobalFeatureManager.Instance.IsEnabled(attribute.FeatureType); return GlobalFeatureManager.Instance.IsEnabled(attribute.GetFeatureName());
} }
} }
} }

19
framework/src/Volo.Abp.GlobalFeatures/Volo/Abp/GlobalFeatures/RequiresGlobalFeatureAttribute.cs

@ -1,15 +1,28 @@
using System; using System;
using JetBrains.Annotations;
namespace Volo.Abp.GlobalFeatures namespace Volo.Abp.GlobalFeatures
{ {
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class RequiresGlobalFeatureAttribute : Attribute public class RequiresGlobalFeatureAttribute : Attribute
{ {
public Type FeatureType { get; } public Type Type { get; }
public RequiresGlobalFeatureAttribute(Type featureType) public string Name { get; }
public RequiresGlobalFeatureAttribute([NotNull] Type type)
{
Type = Check.NotNull(type, nameof(type));
}
public RequiresGlobalFeatureAttribute([NotNull] string name)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
}
public virtual string GetFeatureName()
{ {
FeatureType = featureType; return Name ?? GlobalFeatureNameAttribute.GetName(Type);
} }
} }
} }

Loading…
Cancel
Save