is there a way to use ExpandoObject?
e.g.
Code: Select all
var item = new Dictionary<string, object>
{
{ "StringValue", "value" },
{ "Child", new Dictionary<string, object>
{
{ "IntegerValue", 2 },
{ "SecondChild", new Dictionary<string, object> { { "BooleanValue", true } } }
}
}
};
dynamic dynyStuff = item.AsDynamic();
public static class DictionaryConverter
{
public static dynamic AsDynamic(this IDictionary<string, object> source)
{
var result = new ExpandoObject();
foreach (var item in source)
if (item.Value is Dictionary<string, object>)
Dictionary(result).Add(item.Key, Dictionary(item.Value).AsDynamic());
else
Dictionary(result).Add(item);
return result;
}
private static IDictionary<string, object> Dictionary(object source)
{
return source as IDictionary<string, object>;
}
}
Code: Select all
_report.RegBusinessObject("MyStuff", "dynyStuff ", dynyStuff );
_report.RegData("dynyStuffAsData", dynyStuff);
_report.Dictionary.SynchronizeBusinessObjects(3);