powerdesigner生成C#代码(带注释)
由显示name改为显示code
菜单->Tool->Model Options->Name Convention->右侧display中选择显示name还是code。
同时显示name和Code
菜单->Tool->Display Preference->Class->Advanced->Attribute->List Columns->Select Attributes(选择框右侧下拉选择框旁的放大镜)->给要增加显示的name或code打上勾->将该行上移至要显示的顺序位置。
1.在tools - Generte Object-Oriented Model
2.在detail中convert names into codes,打勾则用名字作为实体类代码里的名称,不打勾就用表中code作为实体类代码里的名称。之后点确定生成类图。
3.这时可以看到language中有edit current object language和generage C# 2 code,
4.edit current object language中profile - Attribute - Templates 里有个definition文件。可以根据自己需要修改实体类模板
带注释例子(要有Name字段):
.if (%isValidAttribute%) ///<summary> ///%Name% ///</summary> [%customAttributes%\n]\ .if (%Multiple% == false) and (%isIndexer% == false) [%visibility% ][%flags% ]%dataType% %Code%[ = %InitialValue%]{get;set;} .else [%visibility% ][%flags% ]%dataType%[%arraySize%] %Code%[ = %InitialValue%]{get;set;} .endif .endif
.if (%isGenerated%) and (%isValidAttribute%) [%comment%\n]\ [%oidDocTag%\n]\ [%customAttributes%\n]\ .if (%Multiple% == false) and (%isIndexer% == false) .if(%visibility% == "public") [%visibility% ][%flags% ]%dataType% %fieldCode%{get;set;}[ = %InitialValue%;] .else [%visibility% ][%flags% ]%dataType% %fieldCode%[ = %InitialValue%]; .endif .else [%visibility% ][%flags% ]%dat%fieldCode%[ = %InitialValue%]{get;set;}%visibility%; .else [%visibility% ][%flags% ]%dataType%[%arraySize%] %fieldCode%[ = %InitialValue%]; .endif .endif
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术