Hi to all, I encountered this problem in the project to which I am working on.
We've got this model:
public interface IPosInfo {
string UID { get; }
TipoPos Tipo { get; set; }
}
public interface IPos : IPosInfo {
ICollection<LogEvent> Log { get; }
}
public class MyPos : IPos {
string UID { get; }
TipoPos Tipo { get: }
ICollection<LogEvent> Log { get; }
}
public class PosComposite : IPos {
List<IPos> Childrens { get; set; }
string UID { get; }
TipoPos Tipo { get: }
ICollection<LogEvent> Log { get; }
ICollection<IPosInfo> ChildrensList {
return Childrens.OfType<IPosInfo>().ToList();
}
}
So, when I serialize an instance of PosComposite, the properety "ChildrensList" is serialized as IPos and not as IPosInfo.
Can I solve this issue with JSon.Net?
Thanks in advance,
Marco