Assume that I have Web API method:
[HttpGet]
public string SomeAction([FromUri] ObjectA a, [FromUri] ObjectB b)
{
return Ok("test");
}
How to call it using HttpClient
? What is the best way to prepare appropriate query string for objects A and B?
UPDATE
ObjectA
and ObjectB
are complex objects... e.g.
public class ObjectA
{
public string Prop1 { get; set; }
public int Prop2 { get; set; }
public double Prop3 { get; set; }
}
I can prepare query string for every specific case, but I'm interested to get any universal method that would allow to work with any objects...
For now I see only one possible solution - using reflection go through the list of properties and build query string. I assume that there should be some already implemented mechanism... am I wrong?