RequiresFeatureAttribute.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. namespace Abp.Application.Features
  3. {
  4. /// <summary>
  5. /// This attribute can be used on a class/method to declare that given class/method is available
  6. /// only if required feature(s) are enabled.
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
  9. public class RequiresFeatureAttribute : Attribute
  10. {
  11. /// <summary>
  12. /// A list of features to be checked if they are enabled.
  13. /// </summary>
  14. public string[] Features { get; private set; }
  15. /// <summary>
  16. /// If this property is set to true, all of the <see cref="Features"/> must be enabled.
  17. /// If it's false, at least one of the <see cref="Features"/> must be enabled.
  18. /// Default: false.
  19. /// </summary>
  20. public bool RequiresAll { get; set; }
  21. /// <summary>
  22. /// Creates a new instance of <see cref="RequiresFeatureAttribute"/> class.
  23. /// </summary>
  24. /// <param name="features">A list of features to be checked if they are enabled</param>
  25. public RequiresFeatureAttribute(params string[] features)
  26. {
  27. Features = features;
  28. }
  29. }
  30. }