How can I generate form xml from C# data type

Oct 20, 2010 at 2:27 PM

I would like to define my data types in C# rather than through the Composite C1 console. I find it easier to track changes to data types when working with other dev's on a project, and to be a bit more "controllable" some how. But this way of working with data types presents me with the pain of having to write my own form xml for the data types i want to have editable in the C1 Console. To avoid this, I'm considering writing a script that will, on system startup, generate a xml file in a specific folder for each data type (if a generated file is not already present), containing default form xml for the data type, just as the xml would have been if it had been created through the C1 console.

I'm not even sure if this is entirely possible, as I cannot attributize my properties with stuff like Label and Help Text, but i suppose i could at least generate a label from the property name using reflection.

I've been digging through the Composite source code to try and find how the default xml is generated, but haven't had any success - maybe there are no existing code that does this?

Can someone point me in the right direction? Am I crazy for wanting this?


Oct 22, 2010 at 12:13 AM

Hmm... take a look at Composite.Functions.StandardWidgetFunctions (you need the source code - this class has [EditorBrowsable(Never)] set on it)

It should be able to give you widget functions based on type info, and those widget functions you should be able to turn into form markup.