public interface ISurvey
{
List<ISurveyItem> Items { get; set; }
int QueueId { get; set; }
SurveyType Type { get; set; } //an enum
SurveyResult ToSurveyResult();
void CopyToSurveyDto(Survey dbsurvey);
}
public interface ISurveyItemBase
{
int Sequence { get; set; }
string Template { get; set; }
string Label { get; set; }
int Id { get; set; }
}
public interface ISurveyItem:ISurveyItemBase
{
SurveyItemType Type { get; set; }//an enum
string Value { get; set; }
}
public class Survey : ISurvey
{
public List<ISurveyItem> Items { get; set; }
public int QueueId { get; set; }
public SurveyType Type { get; set; }
public SurveyResult ToSurveyResult()
{
//implimentation
}
public void CopyToSurveyDto(Data.Survey dbsurvey)
{
//implimentation
}
}
When I try pass the Survey object via POST to my Web API service, the Items property is serialized to an empty list. I imagine this has to do with it not knowing what concrete type to serialize the items too. Are there any pointers on how to do this?