【发布时间】:2014-03-31 13:59:42
【问题描述】:
我正在使用 JSON.NET 6.0.1。当我使用SerializeObject 方法序列化派生类的对象时,它仅序列化基类的属性。这是代码sn-p:
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
{
...
}
我错过了什么吗?
【问题讨论】:
标签: c# serialization json.net