Function based entities save state in a "wrapper" property named after the state type.
This makes it very hard to switch between function types as there are no serialization hooks available. It is too late to change the implementation, I guess. The next best thing would be to have a deserialization hook like the InitializeState method.
A type:
record Answer(int Value);
is saved as (the state value is actually a json string, but that was too hard to type):
{ "state": { "Answer": {"Value": 42} } }
Class based entities derived from TaskEntity<T> save properties directly on the state:
{ "state": {"Value": 42} }
Workaround
My workaround works, but it is too much boiler plate and no way to control when to run it or not.
Problem
Function based entities save state in a "wrapper" property named after the state type.
This makes it very hard to switch between function types as there are no serialization hooks available. It is too late to change the implementation, I guess. The next best thing would be to have a deserialization hook like the
InitializeState
method.A type:
is saved as (the state value is actually a json string, but that was too hard to type):
Class based entities derived from
TaskEntity<T>
save properties directly on the state:Workaround
My workaround works, but it is too much boiler plate and no way to control when to run it or not.