This project is read-only.

Context aware fastJSON instance?

Feb 16, 2014 at 9: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 11:13 AM
You can make the RegisterCustomType() delegate context aware and handle things inside it.
Mar 5, 2014 at 12:37 PM
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 2:12 PM
Great Job!