This project has moved and is read-only. For the latest updates, please go here.

Generated XSD to include list of available enum values for a defined type


Firstly just to say that I think this is a great tool!
1) Could add a designer attribute that allows one to specify a list of acceptable values for enum types which can then be used by the code generator to create the appropriate xsd, thereby providing intellisense within config file (assuming generated schema refenced from config), or better still, infer the values by reflecting the type.
2) Could generate method in configuration section class that allows one to search for a particulate element by xpath expression - (i guess this could also be achieve by use of an extension method). I realize lambda's can be used and can go someway to achieving the same result as specified above. (Most configuration files I end up working with are very generic, list of key/values which are normally exposed as a NameValueCollection or something unspecific for use in various components).
3) Add ability to have configuration elements implement an interface (for which can be generated automatically by code), just need appropriate attribute added to designer and handling of it's value - this makes TDD simpler. I realize that the classes are generated as partial classes and thus this could be done manually, but would be better if could generate automatically).
4) Add ability for classes generated to be in separate files (much like as happens with edmx code behind via poco templates for example).
5) Add ability for separation of xsd and class generation by perhaps allowing csd file to have two file generators specified, one for classes and one for xsd. This way people can implement their own T4 templates should they so desire to implement their own code generation. (This would also need an object model to wrap around the xml model for the csd code-behind - again much in the same way as T4 templates can be used for edmx (entity framework 4) class generation.


andym1978 wrote Jun 21, 2012 at 8:07 PM

These are interesting ideas.

wrote Sep 23, 2012 at 2:55 AM

iLMaX wrote Nov 13, 2012 at 3:53 PM

Hi Rik,
For 1), there is already and option to do this.

1) Define by code you custom enum
2) Open the CSD Designer and open the Configuration Section Explorer
3) Right click the root node (Configuration Section Model) and click "Add new enumerated type"
4) Change name and namespace of EnumeratedType1 (the newly created enumerated type)
5) Set the Code generation options to None for the enumerated type
6) Right click on the enumerated type and click Add new enumeration literal
7) For each enumeration literal change the name and value, the value should correspond to your domain enum
8) Repeat step 6 and 7 for each enum member.

Regards Max

wrote Feb 22, 2013 at 12:30 AM