我正在为我的一个项目使用 ServiceStack.Text 的 JSON 序列化内容。但是,在反序列化数据时,我希望能够覆盖创建对象实例的部分。我希望它使用我的 IoC 容器来创建反序列化期间所需的任何新对象的实例。关于如何执行此操作的任何想法?
最佳答案
在ServiceStack's JSON Serializer有 Hook :
JsConfig<T>.OnSerializingFn
和
JsConfig<T>.OnDeserializedFn
这应该让你这样做。
关于c# - 使用 ServiceStack.Text : override the CreateInstance stuff?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12647278/