How can we bind nested properties from query?
Example model:
public class X {
public string PropA { get;set; }
public string PropB { get;set: }
public Y ClassY { get;set; }
}
public class Y {
[FromQuery(Name = "prop1")]
public string Prop1 { get;set; }
public string Prop2 { get;set; }
}
Class x gets passed into the Controller Action:
public async Task<IActionResult> Search([FromQuery]X classX)
Value of prop1 model y doesn't get bound -> class x is always null.
I would to build my query like so https://host.example/api/x?prop1=example
As an alternative I can flatten out the models but I'd like to avoid that.