• 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
  • 相关阅读:
    sql压缩备份
    解决nodejs中的mysql错误 Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'
    NodeJs创建新的项目和模块
    nodejsq发送formData的数据
    分析SQL语句的性能
    nest classvalidator验证修饰器中文文档
    STM8L不能通过代码设置ROP开启读保护
    uCOS邮箱的使用
    mysql忘记root密码了,怎么办
    01.mybatis
  • 原文地址:https://www.cnblogs.com/superfeeling/p/16216236.html
Copyright © 2020-2023  润新知