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

Created Issue: Complex ModelBinding error/issue [904]

$
0
0
Given a class

public class SearchRepresentation
{
public string Search { get; set; }
public string Code { get; set; }
}

and a Controller method in controller SomeController

public SomeReturnType Get([FromUri] SearchRepresentation search)
{
// Do something here with search.Search or search.Code
}

and call the controller method with the following

http://webserver:port/api/somecontroller?search=red

The SearchRepresentation.Search variable will NOT be populated and both Search and Code will be null. If you change the variable name of the method to be [FromUri] SearchRepresentation xyz where xyz is NEITHER Search NOR Code, then the operation works as expected.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



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