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格式

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

    确认生成即可

  • 相关阅读:
    第五周笔记
    第四周笔记——复制文件(可读时间)
    第三周笔记
    java第6次作业
    java第五次作业
    java第四次作业
    java第三次作业
    第一周Java笔记
    计划进度表
    第六次作业
  • 原文地址:https://www.cnblogs.com/rhyheart/p/8425762.html
Copyright © 2011-2022 走看看