摘要: Route NamesIn Web API, every route has a name. Route names are useful for generating links, so that you can include a link in an HTTP response.To spec... 阅读全文
posted @ 2016-01-04 17:09 a14907 阅读(627) 评论(0) 推荐(0)
摘要: Optional URI Parameters and Default ValuesYou can make a URI parameter optional by adding a question mark to the route parameter. If a route parameter... 阅读全文
posted @ 2016-01-04 17:01 a14907 阅读(1721) 评论(0) 推荐(0)
摘要: Custom Route ConstraintsYou can create custom route constraints by implementing theIHttpRouteConstraintinterface. For example, the following constrain... 阅读全文
posted @ 2016-01-04 16:43 a14907 阅读(961) 评论(0) 推荐(0)
摘要: Route ConstraintsRoute constraints let you restrict how the parameters in the route template are matched. The general syntax is "{parameter:constraint... 阅读全文
posted @ 2016-01-04 16:42 a14907 阅读(373) 评论(0) 推荐(0)
摘要: Route PrefixesOften, the routes in a controller all start with the same prefix. For example:public class BooksController : ApiController{ [Route("a... 阅读全文
posted @ 2016-01-04 16:32 a14907 阅读(731) 评论(0) 推荐(0)
摘要: Prior to Web API 2, the Web API project templates generated code like this:protected void Application_Start(){ // WARNING - Not compatible with att... 阅读全文
posted @ 2016-01-04 16:09 a14907 阅读(511) 评论(0) 推荐(0)
摘要: Extension PointsWeb API provides extension points for some parts of the routing process.InterfaceDescriptionIHttpControllerSelectorSelects the control... 阅读全文
posted @ 2016-01-04 15:51 a14907 阅读(244) 评论(0) 推荐(0)
摘要: HTTP MethodsInstead of using the naming convention for HTTP methods, you can explicitly specify the HTTP method for an action by decorating the action... 阅读全文
posted @ 2016-01-04 14:25 a14907 阅读(617) 评论(0) 推荐(0)