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

30 lines
952 B
C#
Raw Normal View History

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