code-generation

How to stop T4 from executing every time I switch to another tab?

When I edit T4, the script is executed every time I switch to another file. It is OK for quick simple scripts, but some scripts take long time to execute. Is there a way to disable this behavior? I want the script to run only when I save T4 file or manually choose "Run Custom Tool" from the menu. ...

vs2010 automation : Get the text value of a EnvDTE.CodeElement

So I'm playing around with EnvDTE, and the EnvDTE.CodeModel API, And I was wondering if there was a way to get the text value represented by a CodeElement. Let's say I have an CodeAttribute, is there some way to get a string of what the CodeAttribute represents, i.e.[MyAttribute(value="myvalue")]. I know it's possible to reconstruct th...

If you generate a database using EF, do you also use EF to manage the database?

"Manage" as in, make changes to the tables. If yes, how does this work with multiple developers and multiple copies of the database (for development/production)? ...

Should I use single or multiple configuration files for Code Generation

I have a php script that generates php and javascript wrapper classes that handle json marshalling based on a configuration file. My initial plan was to have a single config file that generates all the classes used by the application. However, my team lead suggested I use a separate file for each feature, to avoid creating a gigantic co...

Codegeneration vs text string evaluation

What are the advantages and disadvantages of the following approaches to the management of repetitive code: 1) Use exec(), eval(), and similar functions in other languages for Keyword in KeywordsUpperCase: exec(Keyword + " = \"" + Keyword.lower() + "\"") 2) Use external code generator which uses its own language (which is interle...

Runtime code generation and compilation

Say I have this code that uses some input (e.g. a URL path) to determine which method to run, via reflection: // init map.put("/users/*", "viewUser"); map.put("/users", "userIndex"); // later String methodName = map.get(path); Method m = Handler.class.getMethod(methodName, ...); m.invoke(handler, ...); This uses reflection so the per...