I want to switch some code from using .NET's DataContractSerializer
to using ServiceStack's TypeSerializer
for the increased speed benefits. Unfortunately, the code I inherited relies rather heavily on OnSerializing
/OnSerialized
/OnDeserializing
/OnDeserialized
, which ServiceStack appears not to call. Am I missing something? Assuming not, is there a good way to abuse things to fake out the intended functionality? OnSerialized
/OnDeserialized
can be roughly approximated through reflection, but I'm at a loss for OnSerializing
and OnDeserializing
.
Asked
Active
Viewed 497 times
3

Benjamin Pollack
- 27,594
- 16
- 81
- 105
-
As you're now aware, ServiceStack Text serializers don't call or look for any user-defined event hooks on your models. – mythz Apr 16 '12 at 19:59
1 Answers
2
No, there is no such facility; you'd have to fork ServiceStack or jacket the serialization/deserialization yourself with appropriate calls.

Benjamin Pollack
- 27,594
- 16
- 81
- 105
-
This answer is obsolete (as of 2021), see [ServiceStack OnDeserialized Equivalent](https://stackoverflow.com/q/66057798/3744182) for how to use ServiceStack's [serialization hooks](https://github.com/ServiceStack/ServiceStack.Text/blob/master/tests/ServiceStack.Text.Tests/SerializationHookTests.cs). – dbc Feb 05 '21 at 15:59