// 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 Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Mvc.Controllers; namespace Microsoft.AspNetCore.Mvc.Routing { /// /// /// A metadata interface which specifies a route value which is required for the action selector to /// choose an action. When applied to an action using attribute routing, the route value will be added /// to the when the action is selected. /// /// /// When an is used to provide a new route value to an action, all /// actions in the application must also have a value associated with that key, or have an implicit value /// of null. See remarks for more details. /// /// /// /// /// The typical scheme for action selection in an MVC application is that an action will require the /// matching values for its and /// /// /// /// For an action like MyApp.Controllers.HomeController.Index(), in order to be selected, the /// must contain the values /// { /// "action": "Index", /// "controller": "Home" /// } /// /// /// If areas are in use in the application (see which implements /// ) then all actions are consider either in an area by having a /// non-null area value (specified by or another /// ) or are considered 'outside' of areas by having the value null. /// /// /// Consider an application with two controllers, each with an Index action method: /// - MyApp.Controllers.HomeController.Index() /// - MyApp.Areas.Blog.Controllers.HomeController.Index() /// where MyApp.Areas.Blog.Controllers.HomeController has an area attribute /// [Area("Blog")]. /// /// For like: /// { /// "action": "Index", /// "controller": "Home" /// } /// /// MyApp.Controllers.HomeController.Index() will be selected. /// MyApp.Area.Blog.Controllers.HomeController.Index() is not considered eligible because the /// does not contain the value 'Blog' for 'area'. /// /// For like: /// { /// "area": "Blog", /// "action": "Index", /// "controller": "Home" /// } /// /// MyApp.Area.Blog.Controllers.HomeController.Index() will be selected. /// MyApp.Controllers.HomeController.Index() is not considered eligible because the route values /// contain a value for 'area'. MyApp.Controllers.HomeController.Index() cannot match any value /// for 'area' other than null. /// /// public interface IRouteValueProvider { /// /// The route value key. /// string RouteKey { get; } /// /// The route value. If null or empty, requires the route value associated with /// to be missing or null. /// string RouteValue { get; } } }