// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Mvc.Routing;
namespace Microsoft.AspNet.Mvc
{
///
/// Specifies an attribute route on a controller.
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class RouteAttribute : Attribute, IRouteTemplateProvider
{
private int? _order;
///
/// Creates a new with the given route template.
///
/// The route template. May not be null.
public RouteAttribute([NotNull] string template)
{
Template = template;
}
///
public string Template { get; private set; }
///
/// Gets the route order. The order determines the order of route execution. Routes with a lower order
/// value are tried first. If an action defines a route by providing an
/// with a non null order, that order is used instead of this value. If neither the action nor the
/// controller defines an order, a default value of 0 is used.
///
public int Order
{
get { return _order ?? 0; }
set { _order = value; }
}
///
int? IRouteTemplateProvider.Order
{
get
{
return _order;
}
}
///
public string Name { get; set; }
}
}