Nested ExpandoObject not being parsed by template
I have a rather complex json object that is a hierarchy of nested components. I also have a series of nested hb templates for rendering the data. If I am using a JObject to render my templates against, everything works correctly, but the rendering time is rather slow - ~3-4 seconds.
I saw information in issue 56 that seems to indicate using and ExpandoObject would give considerably better performance over a JObject. Converting the json to an ExpandoObject results in a series of nested ExpandoObjects that I expect to use as the data for the templates. However, the nested objects don't seem to be working as references and my templates aren't rendering as I expect them to.
If I attempt to render the context in one of my templates, the result is "System.Dynamic.ExpandoObject" instead of the data in the json. This seems to indicate that the nested expandoObjects are causing issue.
Is there a different way to access this, and will using an ExpandoObject over a JObject give me much of a performance boost?
I am going to try to put together a test to demonstrate this issue as I have time.
Thanks
will using an ExpandoObject over a JObject give me much of a performance boost?
In the benchmarks cited in #56, using an ExpandoObject was roughly 9 times faster than JObject. So, yes, it will give you a considerable performance boost.
I would need to see the code to understand the exact issue you're reporting.
Yeah - that is definitely why I want to use the ExpandoObject. Have you ever seen issues with using ExpanoObjects and nested HB templates in the past? I can't seem to get the context to resolve for the nested templates. Unfortunately, I haven't had an opportunity to build out a failing unit test for this scenario.
I am not sure what you mean without seeing an example.
I found the issue - I was attempting to convert my templates from using a JObject to an ExpandoObject. In my template, I was accessing the context objects using the JObject method - ie, appending .Value to any property. Removing the .Value allowed my templates to render successfully.