简体   繁体   English

记录自动生成的代码

[英]Documenting auto-generated code

I use code-generation for my data access layer and Doxygen for documentation. 我将代码生成用于数据访问层,并将Doxygen用于文档。 My problem is that I can't add Xml comments on the generated classes since they will be overwritten as soon as I re-generate the code. 我的问题是我无法在生成的类上添加Xml注释,因为一旦我重新生成代码,它们就会被覆盖。 To be more precise I can add Xml comments to my custom methods (which are in a separate file as partial classes) but I can't do it on data properties. 更准确地说,我可以将Xml注释添加到我的自定义方法中(这些注释作为子类在一个单独的文件中),但不能在数据属性上执行。

Any suggestions? 有什么建议么?

使用Doxygen, 您不必编写分散在整个文件中的文档 ,因此您可以将其与生成的代码分开,并在生成后的步骤中将其添加到生成的文件中。

Keep the documentation in your model, and have your CST templates pull out & write that information to the generated code. 将文档保存在模型中,并让CST模板拉出并将该信息写入生成的代码。

For example, you can comment (is comment the right word? Maybe the field is called summary) tables and columns in your SQL database - i know of a few codegen solutions that automatically put that text into your code... 例如,您可以在SQL数据库中注释(注释正确的单词?也许该字段称为摘要)表和列-我知道有一些代码生成解决方案可以自动将文本输入代码中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM