我正在使用 JSON.NET 6.0.1 版本。当我使用 SerializeObject
方法对我的派生类对象进行序列化时,它只会序列化基类的属性。以下是代码片段:
string v = JsonConvert.SerializeObject(
service,
Formatting.Indented,
new JsonSerializerSettings()
{
TypeNameHandling = TypeNameHandling.All
});
基础类:
[DataContract]
public abstract partial class DataEntity : IDataEntity, INotifyPropertyChanging, INotifyPropertyChanged
{
...
}
派生类:
[Table(Name = "dbo.mytable")]
public sealed class mytable : DataEntity
{
...
}
我有什么遗漏吗?