1. 程式人生 > >PowerDesigner 生成C#實體模版代碼

PowerDesigner 生成C#實體模版代碼

image name att package end tail not als interface

操作步驟見: https://blog.csdn.net/da454122373/article/details/54346217

最後的template 模版代碼如下:

.if (%isValidAttribute%)

///<summary>
///[%comment%\n]\
///</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

如果需要增加命名空間,在 classifier/Templates/sourceBody中修改如下:紅色字體是你需要的命名空間

.// only toplevel classes are generated
.if (%ContainerClassifier% == null)
.// header and usings
[\
%usings%\n
]\
.// class/interface definition (global namespace)

.ifnot (%Package.namespace%)
namespace Tiandi.Web.Authority.Model
{
%definition%
}
.else
[\
%Package.comment%
]\
[\
%Package.customAttributes%
]\
namespace %Package.namespace%
{
%definition%
}
.endif
.endif

效果如下,簡單的一個結構

技術分享圖片

記錄以便後期需要

PowerDesigner 生成C#實體模版代碼