forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoutePrefixAttribute.cs
More file actions
42 lines (37 loc) · 1.51 KB
/
RoutePrefixAttribute.cs
File metadata and controls
42 lines (37 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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
{
/// <summary>
/// Annotates a controller with a route prefix that applies to actions that have any <see cref="RouteAttribute"/>s on them.
/// </summary>
[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
{
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute" /> class without specifying any parameters.
/// </summary>
protected RoutePrefixAttribute()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RoutePrefixAttribute" /> class.
/// </summary>
/// <param name="prefix">The route prefix for the controller.</param>
public RoutePrefixAttribute(string prefix)
{
if (prefix == null)
{
throw Error.ArgumentNull("prefix");
}
Prefix = prefix;
}
/// <summary>
/// Gets the route prefix.
/// </summary>
public virtual string Prefix { get; private set; }
}
}