Is IOG Compatible with ExpandoObject?

Jun 15, 2012 at 8:33 PM

The documentation states that IOG only works with objects that have defined interfaces.

Is there a way to make IOG work with ExpandoObjects?

With the ExpandoObject, you can dynamically add properties at runtime.

These are discoverable using reflection, so in theory IOG could learn properties for such an object.

I can see an additional issue in that properties of an ExpandoObject can be added or removed as well, however, an ExpandoObject can be cast to the IDictionary<string,Object> interface, which may be one way to deal with it.  In other words, treat it just as you treat a dictionary now.

Thanks for any information you can provide.

 

Ken Carpenter

Coordinator
Jun 16, 2012 at 12:20 PM

Hello,

that is correct. Types have to be statically defined - for now.

It sounds like a good idea to use IDictionary as underlying mechanism for storing ExpandoObject, my impression is that it would be possible to implement this way.

I've made a feature proposal out of this, scheduled to be implemented in IOG 2.0.

In the mean time I would suggest to use IDictionary instead.

 

Best regards,

Nenad Sabo