Daniel's template is nice and all, but I've put some more effort into such a template so it does all these:
- generates enumeration values with explicit integer values;
- uses Visual Studio's namespace naming convention so generated enumerations have project's default namespace with any subfolders appended (just like any code file in Visual Studio);
- adds complete enumeration XML documentation by using additional description table column values; if you don't have these never mind;
- correctly names the generated file and adds an additional attribute in the code so the generated
enum
doesn't get scrutinised by code analysis;
- multi-word lookup table values are correctly concatenated to pascal-cased equivalents (ie. Multi word value becomes a
MultiWordValue
);
- enumeration values always start with a letter;
- all enumeration values consist of only letters and numbers, everything else gets cut out;
Anyway. Everything is very well documented in this blog post.