This removes all of the (now actually non-trivial) conversion logic from
the class which is actually responsible for executing the Jint engine.
This moves it all to a new service which uses chain of responsibility to
convert the result, using one of a few different mechanisms.
Of note is the handling of ExpandoObject when no specific type
information has been provided, and also the handling of enumerables,
with the exception of strings.
Unfortunately Jint still chokes in this case if the expando contains
further nested expandos. It turns out that I need to do this
recursively for it to always work.
We also have trouble with IEnumerable types. They also can't be
round-tripped from/to JSON when they aren't deserialized as a very
specific type.
It appears that this can be fixed by intercepting occasions
when Jint returns an ExpandoObject but the desired return type
is simply object. In this scenario we must return
a Dictionary<string,object> instead of a simple object, or else
Jint freaks out should we try to stringify it later.
I also added a second test to prove that making this change hasn't
broken the way we expect Jint to work for us.
This is an experimental commit. It does stop the exception from
occurring, but it doesn't really fix the problem because now the
output is always empty-object.
It does prove that the exception was occurring because of the
usage of JsonConvert to serialize/deserialize the result.
The change made in this commit probably can't go into prod
but it is useful because it llustrates a part of the problem.
* Variables are now stored including their type name for automatic deserialization into their actual type. This is important for use in expressions.
* **SplitObject** and **ExecuteMethod** now use workflow expressions instead of variable names. This allows for more flexibility.
* Improved **Join** activity to allow proper function within looping constructs.
* Improved Variables performance. Variables are no longer serialized/deserialized upon writing/reading perspectively, only when the workflow instance is persisted.
* Refactor buggy SignalRequestHandler
For some reason, the following code is problematic:
await DecryptToken()
.BindAsync(GetWorkflowInstanceAsync)
.BindAsync(CheckIfExecutingAsync)
.MapAsync(ResumeWorkflowAsync);
Basically, any lambda in the BindAsync and MapAsync could execute even after the containing method returned
* Implement better message handler registration without adding multiple IMediator services
* Abstracted Mediator service registration methods.
* Add Liquid support for JObject.