zoukankan      html  css  js  c++  java
  • PowerDesigner 创建数据库模型、自动生成模型类、自动生成Sql脚本

     一、保存工作空间

    二、文件->新建模型

    三、新建数据库表

    四、修改数据库表名称

    五、设置数据库表字段

    六、工具->Generate Object-Oriented Model

    打开详情页签,去掉“检查模型”和名称转换为编码

    打开常规,选择你想要生成的语言,应用并确认

    七、语言 > Edit Current Object Language > Profile > Attribute > Templates > definition

    按自己的需求重写代码实体生成模板应用确认即可,比如我的C#模板:

    .if (%isValidAttribute%)

    ///<summary>
    /// [%Name% ]
    .if (%comment%)
    [%comment% ]
    .endif
    ///</summary>

    .if (%Multiple% == false) and (%isIndexer% == false)
    [%visibility% ][%flags% ]%dataType% %Code%[ = %InitialValue%] { get; set; }

    .else
    [%visibility% ][%flags% ]%dataType%[%arraySize%] %Code%[ = %InitialValue%] { get; set; }

    .endif
    .endif

    八、语言 > Edit Current Object Language > Profile > classifier > Templates > sourceBody

    按自己的需求重写代码命名空间生成模板应用确认即可,比如我的C#模板:

    .// only toplevel classes are generated
    .if (%ContainerClassifier% == null)
    .// header and usings
    [
    %usings%
    
    ]
    .// class/interface definition (global namespace)
    .ifnot (%Package.namespace%)
    namespace Database.Models
    {
    %definition%
    }
    .else
    [
    %Package.comment%
    ]
    [
    %Package.customAttributes%
    ]
    namespace %Package.namespace%
    {
    %definition%
    }
    .endif
    .endif

      

    九、语言->Generate C# Code->Generated Files

    选择你需要代码的生成的模型

    十、数据库->Change Current DBMS

    选择你要生成的Sql格式

    十一、数据库->生成数据库

    确认生成即可

  • 相关阅读:
    contest hunter5105 Cookies
    bzoj2599: [IOI2011]Race
    poj1741 Tree
    bzoj2527: [Poi2011]Meteors
    bzoj3673: 可持久化并查集 by zky&&3674: 可持久化并查集加强版
    bzoj2741: 【FOTILE模拟赛】L
    bzoj3110: [Zjoi2013]K大数查询
    bzoj1901: Zju2112 Dynamic Rankings
    bzoj2821: 作诗(Poetize)
    poj1417 True Liars
  • 原文地址:https://www.cnblogs.com/rhyheart/p/8425762.html
Copyright © 2011-2022 走看看