aspnet/Mvc — pull request #1169 by javiercn (2014-09-23 18:25:48+00:00)
Title: [Fixes #737] Attribute Routing: Come up with a good scheme for generatin...

...g route group tokens (optimization)

Assigns route group values to each attribute routed action descriptors
by giving each descriptor a secuential number as their route group and
keeping track of the action descriptors for which it has provided a
route group value.

The value of the group id for an action descriptor will be their position
on the list the first time we see that action descriptor. Other actions
with the same route group will get the same route group value because we
will scan the list for equivalent action descriptors before giving them
a value.

For example:
Given the following controller
public class CustomersController
{
[HttpGet("Customers/Index")] // Action descriptor 1
public ActionResult Index() { }

[HttpGet("Customers/Edit")] // Action descriptor 2
public ActionResult Edit() { }

[HttpPut("Customers/{id}")] // Action descriptor 3
public ActionResult Put() { }

[HttpPatch("Customers/{id}", Order = 1)] // Action descriptor 4
[HttpPatch("Customers/UpdateCustomer/{id}")] // Action descriptor 5
public ActionResult Patch() { }

[HttpPut("Customers/{id}")] // Action descriptor 6
public ActionResult Delete() { }
}

Action descriptor 1 with template /Customers/Index and order 0 will have route group id 0.
Action descriptor 2 with template /Customers/Edit and order 0 will have route group id 1
Action descriptor 3 with template /Customers/{id} and order 0 will have route group id 2
Action descriptor 4 with template /Customers/{id} and order 1 will have route group id 3
Action descriptor 5 with template /Customers/UpdateCustomer/{id} and order 0 will have route group id 4
Action descriptor 6 with template /Customers/{id} and order 0 will have route group id 5