我有一个具有可序列化属性的对象,该类继承自抽象类,该抽象类继承自其他类,该类也可序列化,该类继承自接口
我用过
string included = JsonConvert.SerializeObject(msg,
Formatting.Indented,
new JsonSerializerSettings { /*ContractResolver = new NotificationPropertyResolver()*/ TypeNameHandling = TypeNameHandling.All});
因为 msg 是我想在 SignalR 中发送这个对象的接口,我看到它不会忽略任何成员,我已经装饰了接口和类
有解决方案吗?我也尝试过使用具有自己属性的解析器 - 但结果仍然相同
课程很大但是...
[Serializable]
[WebAPINotification(Type = typeof(CSensor), Group = "Sensor")]
public class SensorsStateModeNotification : SensorNotification, IBPMPackagedNotification
public abstract class SensorNotification : BasicLanNotification, ISensNotification
[Serializable]
public class BasicLanNotification : BasicNotification, ILanNotification
[Serializable]
public abstract class BasicNotification : INotification, ISerializable, IOpSerializable
[JsonIgnore]
public long SentAt
{
get
{
return m_sentAt;
}
set
{
m_sentAt = value;
}
}
/// <summary>
///
/// </summary>
[JsonIgnore]
public ENotificationGateway NotificationGateway
{
get
{
return m_NotifyGateway;
}
set
{
m_NotifyGateway = value;
}
}