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
标签:flags%,visibility%,code,InitialValue%,C#,dataType%,powerdesigner,注释,endif 来源: https://www.cnblogs.com/superfeeling/p/16216236.html