Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: Action selection shouldn't depend on whether an Uri based parameter is able to be bound or not. [821]

$
0
0
This is from the post : http://stackoverflow.com/questions/14610039/how-to-disambiguate-between-two-actions-in-apicontroller

1. __Works (Note: the parameter is NOT an array__
Url=http://localhost:9597/api/values?projectId=2
```
public class ValuesController : ApiController
{
public string GetMany(int projectId)
{
return "GetMany";
}

public string GetAll()
{
return "GetAll";
}
}
```

2. __Does NOT work(receiving ambiguity error):__
Url=http://localhost:9597/api/values?projectId=2,3,4
```
public class ValuesController : ApiController
{
public string GetMany([FromUri]int[] projectId)
{
return "GetMany";
}

public string GetAll()
{
return "GetAll";
}
}
```

There shouldn't be disambiguity in action selection in the 2nd case above as the parameter 'projectId' is correctly specified. I believe the action selection is looking for TypeConverter here as its an Array which is a Complex Type. Since Array is not having a TypeConverter, it seems to not consider the presence of this parameter, making it think to be ambiguous.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>