Hi, consider this example:
public class MyControl
{
public int Id { get; set; }
}
public class MyWebControl : MyControl
{
public string Name { get; set; }
}
public class Panel : MyWebControl
{
public IList<MyWebControl> Controls {get;set;}
public Panel()
{
Controls = new List<MyWebControl>();
}
}
//Dto response in ServiceStack
var ctr1 = new MyWebControl { Id = 1, Name = "control1"};
var ctr2 = new MyWebControl { Id = 2, Name = "control2"};
var panel1 = new Panel { Id= 3, Name = "container1"};
panel1.Controls.Add( ctr1);
panel1.Controls.Add( ctr2);
var panel2 = new Panel { Id= 4, Name = "container2"};
panel2.Controls.Add( panel1);
return panel2;
ServiceStack's JsonSerializer do not serialize the controls ctr1 e ctr2.
so the only solution would be to work with interface or abstract class?
Thanks