// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using System.Web.Http.Routing;
namespace System.Web.Http
{
///
/// Annotates a controller with a route prefix that applies to actions that have any s on them.
///
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Justification = "This attribute is intended to be extended by the user.")]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public class RoutePrefixAttribute : Attribute, IRoutePrefix
{
///
/// Initializes a new instance of the class without specifying any parameters.
///
protected RoutePrefixAttribute()
{
}
///
/// Initializes a new instance of the class.
///
/// The route prefix for the controller.
public RoutePrefixAttribute(string prefix)
{
if (prefix == null)
{
throw Error.ArgumentNull("prefix");
}
Prefix = prefix;
}
///
/// Gets the route prefix.
///
public virtual string Prefix { get; private set; }
}
}