Reflecting DynamicContent ‘Values’ (fields)

Posted by Community Admin on 04-Aug-2018 22:57

Reflecting DynamicContent ‘Values’ (fields)

All Replies

Posted by Community Admin on 31-Jul-2012 00:00

Hello,

In order to write a generic class, I would like to get all of the field names of a DynamicContent type, so I can convert them into a class that can be used by .NET JSON deserialization methods.

Is this possible, or will I have to write an individual method for each data type? Are there any other ways to do this, that are better than this current idea?

Thanks in advance for your help!
Rich

Posted by Community Admin on 05-Sep-2012 00:00

Hi Sitefinity community!

It would be great if anyone has worked out how to do this, or similar... I'm right now on a breakpoint with a DynamicContent item, trying to figure out:

"How do I figure out what the field name for the Identifying FIeld on a DynamicContent is?"  or even better, a complete list of fields available using .GetValue<>

Any insight will be great

Posted by Community Admin on 05-Sep-2012 00:00

So, to get all fields you can use:

var properties = System.ComponentModel.TypeDescriptor.GetProperties(dataItem);

Reviewing this will give you everything you need, EXCEPT for any method of identifying which field is the "Identifying Field" unfortunately, from my investigation.

If anyone (Sitefinity?) has more insight, that would be great.

This thread is closed