Context aware fastJSON instance?

Feb 16, 2014 at 8:27 AM

I have a usecase where I need to add context aware serialization.
That is, when deserializing a special type, I need to do lookups against a context.

So I need to register a context bound delegate for the deserialization of this type.
Doing this with the fastJSON.JSON.Instance.RegisterCustomType will not work since it is static and thus shared between my contexts.

Feb 16, 2014 at 10:13 AM
You can make the RegisterCustomType() delegate context aware and handle things inside it.
Mar 5, 2014 at 11:37 AM
My framework is multithreaded and there can be multiple context alive at the same time.
I solved this by using a [ThreadStatic] var for the context, so the RegisterCustomType delegate will use that feild to resolve the current context.
This works fine.
Mar 5, 2014 at 1:12 PM
Great Job!