zoukankan      html  css  js  c++  java
  • powerdesigner 生成实体代码 附加生成xml

    转自 http://www.java123.net/546230-1.html ,模板已修改成自己的

    1.打开 Object Language Properties

    菜单位置:Language → Edit Current Object Language

    在 C# 2::ProfileClassifierGenerated Files ,创建一个 entity.xml 文件。

    Name: entity.xml

    FileName:%topContainerCode%.xml

    Encoding: utf-8

    Comment:

    .if (%isGenerated%)

    .set_object(_usingContext,,new)

    [ %NHebernateHead% ]

    %NHebernateBody%

    %NHebernateFoot%

    .endif  

    %NHebernateBody%

    2.设置%NHebernateBody%模板的内容

    在 C# 2::ProfileClassifierTemplates ,新建一个模板 NHebernateBody


    <entity name="%Code%" remarks="%Name%" primarykey="id" >

    .foreach_item(Attributes)
    <field name="%Code%" type="%dataType%" remarks="%Name%" isnull="false"></field>

    .next

    </entity>

    3.配置输出NHibernate的xml文件

    在 C# 2::ProfileBasePackageTemplatesVisual Studio ,将模板修改为:

    .// Declare classifiers of the package
    .foreach_item(Classifiers,,,%IsShortcut%==false)
    .if (%IsSelected%) and (%isInner% == false)
    <File
    RelPath = "%sourceFilePath%"
    SubType = "Code"
    BuildAction = "Compile"
    />
    <File
    RelPath = "%sourceFilePath%\%topContainerCode%.xml"
    BuildAction = "EmbeddedResource"
    />
    .endif( )
    .next
    .// Declare classifiers of the subpackages
    .foreach_item(Packages,,,%IsShortcut%==false)
    .if (%isAssembly% == false)
    %ProjectSourceFiles%
    .endif
    .next

    NHibernate的xml配置完成。

    最后,一起导出实体和NHibernate的.xml文件

    菜单位置:Language → Generate C# 2 Code

  • 相关阅读:
    mysql 时间戳
    UTF8有BOM和无BOM
    php正则表达式
    二叉树的一些操作
    简单的Oracle触发器使用
    简单的Java调用Oracle存储过程
    Oracle知识关键字
    List和Set
    MyEclipse 快捷键
    Java零基础系列006——小测试(循环)
  • 原文地址:https://www.cnblogs.com/lucoo/p/5853542.html
Copyright © 2011-2022 走看看