using System; using System.Linq; namespace Umbraco.Web.Common.Attributes { /// /// Indicates that a controller is a plugin controller and should be routed to its own area. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class PluginControllerAttribute : Attribute { /// /// Initializes a new instance of the class. /// /// public PluginControllerAttribute(string areaName) { // validate this, only letters and digits allowed. if (areaName.Any(c => !char.IsLetterOrDigit(c))) throw new FormatException($"Invalid area name \"{areaName}\": the area name can only contains letters and digits."); AreaName = areaName; } /// /// Gets the name of the area. /// public string AreaName { get; } } }