Generate EF4 POCO classes first time only
The problem I'm having is, using the POCO templates, generating my POCO classes the first time only and not overwriting them when the templates are re-ran. I know this sounds hokey and the reason is that I'm actually changing these templates and trying to generate metadata classes rather than the actual POCO classes, but these metadata classes will be hand-edited and I want to keep those edits in the future but still 开发者_StackOverflow中文版regenerate a certain amount of it. I have it all working exactly as I want except for the regeneration of the files.
I have looked into T4 and it seems that there is a flag to do just this (see the Output.PreserveExistingFile property) but I don't understand where/how to set this flag. If you can tell me where/how to set this in the default POCO templates, then I think that's all I really need.
Thanks!! :-)
PreserveExistingFile property is only available in T4 Toolbox. POCO templates are plain T4, someone would have to convert them. Any volunteers?
You're doing this wrong.
All the classes created are partial classes. If you wish to alter the templates create new partial classes and put your code in them.
精彩评论