Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Binding FromUri to complex object ignores DataMember Name

$
0
0

Binding from query string using [FromUri] to a complex object ignores [DataMember] attribute with changed parameter name.

// Call GET /method?changed_id=123
public void GetMethod([FromUri]ExampleModel model)
{
   // The model.Id = null
}

[DataContract]
public class ExampleModel
{
   [DataMember(Name = "changed_id")]
   public int? Id { get; set; }
}

BTW I do not know where to report this serious bug.


Viewing all articles
Browse latest Browse all 4850

Trending Articles



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