Strange issue- I have a complex DTO with several child objects, declared like this:
[code]
public class ScoutingReportProPitcher
{
[DataMember]
public Guid ReportID { get; set; }
[DataMember]
public ScoutingReport Report { get; set; }
[DataMember]
public ScoutingReportPro Pro { get; set; }
[DataMember]
public ScoutingReportPitcher Pitcher { get; set; }
}
[/code]
All is being sent to the client correctly. When he tries to send the data back in a PUT or a POST, the child objects are not filled in. I thought maybe I had to initialize the child objects in the DTO constructor – but this just resulted in the inbound object having child objects with all empty properties.
I had my UI developer send me the JSON object that he’s POSTing to me, when I run the JsonSerializer.DeserializeFromString, the object seems to get filled correctly.
What else can I look at to determine why the object isn’t getting passed into the POST method correctly from the outside?
thanks
Can you show us the json data you are trying to send? Also what is the code sending the PUT and POST look like.
Have you tried using Fiddler and looking at the data? http://www.fiddler2.com/fiddler2/
To see the raw data in code you need to intercept the Input stream and prevent the deserialization from occurring. You will want to undo this once you fix it.
First decorate your DTO class with IRequiresRequestStream like
Second, in the OnBeforeExecute(T request) method you can peak at the json data by logging or inspecting with a breakpoint.
See here for a more full explanation: https://groups.google.com/d/topic/servicestack/l9qFvZNbuT0/discussion