Where is the RouteOrder property in the Route attribute?

In accordance with asp.net documentation in RouteAttributea property RouteOrder. However, I cannot find this in the code. I can find Order, but not RouteOrder. Should I assume they are the same?

enter image description here

+4
source share
1 answer

Yes, they are the same. I followed the same article and I ran into this problem ( RouteOrderdoes not exist in System.Web.Http.RouteAttribute).

I did a quick test in my Web API 2 application to verify:

[Route("{name}")] // unconstrained parameter
[HttpPost]
public string Test(string data) {
    return data;
}

[Route("preview")] // literal
[HttpPost]
public string Preview(string data) {
    return data;
}

api/preview Fiddler, Preview() , . , :

[Route("preview"), Order = 1] // literal
[HttpPost]
public string Preview(string data) {
    return data;
}

api/preview, Test(), RouteOrder. , , !

+1

All Articles