ServiceStack(SS)で奇妙な問題が発生しています。メソッドに渡すエンティティは、SSによって常に空のjson文字列にシリアル化されます。したがって、sは常に「{}」です。デバッグすると、エンティティが値を持つプロパティを持つハイドレイトインスタンスであることがわかります。
なぜこれが当てはまるのか、何か考えはありますか?
public virtual void Serialize<TEntity>(TEntity entity, Stream stream)
{
// s is always {}
var s = JsonSerializer.SerializeToString(entity);
// rest is not important at this point...
s = JsvFormatter.Format(s);
using (var writer = new StreamWriter(stream))
{
writer.Write(s);
}
}
渡された(VolumeCreated)エンティティが正確に何であるかを示す質問を編集しています。
public class VolumeEvent : IEvent<VolumeID>
{
public VolumeEvent(VolumeID identity)
{
Identity = identity;
}
#region Implementation of IEvent<out VolumeIdentity>
public VolumeID Identity { get; private set; }
#endregion
}
public class VolumeCreated : VolumeEvent
{
public DateTime PublishDate { get; set; }
public string Title { get; set; }
public VolumeCreated(VolumeID identity, string title, DateTime publishDate)
: base(identity)
{
Title = title;
PublishDate = publishDate;
}
}