Files
Umbraco-CMS/src/Umbraco.Web/Mvc/PluginControllerAttribute.cs

30 lines
952 B
C#

using System;
using System.Linq;
namespace Umbraco.Web.Mvc
{
// TODO: This has been moved to netcore so can be removed when ready
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class PluginControllerAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PluginControllerAttribute"/> class.
/// </summary>
/// <param name="areaName"></param>
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;
}
/// <summary>
/// Gets the name of the area.
/// </summary>
public string AreaName { get; }
}
}