Disambiguate actions correctly when they are overloaded by Enum types


The details behind this issue can be found here:

Enum types by default are FromUri as it has a TypeConverter from string.
Closed May 23, 2013 at 12:47 AM by kichalla


HongmeiG wrote Aug 13, 2012 at 5:38 PM

we should make sure the logic finding the simple type are the same between model binding and action selection.

EdCh wrote Oct 6, 2012 at 4:47 PM

marcind wrote Jan 21, 2013 at 8:45 PM

Just ran into this as well. If you take the default WebAPI project template and replace the optional int id parameter on the get methods:

    // GET api/values
    public IEnumerable<string> Get()
        return new string[] { "value1", "value2" };

    //// GET api/values/5
    public string GetBaz(SomeEnum id)
        return "value";

Then WebAPI will no longer be able to disambiguate between these 2 methods and throw an exception saying there are 2 action methods matching the request.