zoukankan      html  css  js  c++  java
  • 有关CodeBuilder中基础模板的说明

    CodeBuilder中的Template.FbBase是一个基于xml语法的基础模板,主要由defkeys、functions、parts、sections构成。

    代码
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- 该文件由faib studio定义,版本为1.0 -->
    <!-- 
    language:生成的代码语言Sql|CSharpText等等
    convert:数据类型转换字典配置
    -->
    <config name="生成MSSQL脚本" language="Sql" convert="csconvert.config">
      
    <!-- 定义一些常量,这些常量也使用$key$进行引用 -->
      
    <defkeys>
        
    <key name="Author">Faib</key>
      
    </defkeys>
      
    <!--
      定义一些外部函数
      language:代码文件的语言类型 CSharp|VBasic
      file:代码文件
      
    -->
      
    <functions>
        
    <function name="ColumnSql" language="CSharp" file="code\sqlcolumn.cs" />
      
    </functions>
      
    <!-- 结构:parts\part\sections\section -->
      
    <!-- 注意调用顺序的定义 -->
      
    <parts>
        
    <part name="SQL" file="Design\create.sql" loop="None">
          
    <sections>
            
    <section name="TableCreate" loop="Tables">
              
    <sections>
                 
    <section name="ColumnArray" loop="Columns" endchar=",">
        [$ColumnName$] $GetColumnSql()$
    </section>
                 
    <section name="ColumDescript" loop="Columns">
    <![CDATA[$AddColumnDescription()$
    go
    ]]>
                 
    </section>
                 
    <section name="PrimaryCreate" loop="PrimaryKeys">
    <![CDATA[alter table $TableName$
        add constraint PK_$TableName$_$ColumnName$ primary key ($ColumnName$)
    go
    ]]>
                 
    </section>
              
    </sections>
              
    <body>
        
    <![CDATA[
    create table [$TableName$] ($ColumnArray$
    )
    go

    $PrimaryCreate$

    -- Region 添加说明
    $AddTableDescription()$
    go

    $ColumDescript$
    -- EndRegion
    ]]>
              
    </body>
            
    </section>
            
    <section name="ReferenceDelete" loop="Tables">
              
    <sections>
                 
    <section name="ReferenceDelete1" loop="RefObjects">
    <![CDATA[if exists (select 1
        from sysobjects
        where id = object_id('FK_$FKTableName$_$PKTableName$')
        and type = 'F')
            alter table $FKTableName$
            drop constraint FK_$FKTableName$_$PKTableName$
    go
    ]]>
                 
    </section>
              
    </sections>
              
    <body>
        
    <![CDATA[$ReferenceDelete1$]]>
              
    </body>
            
    </section>
            
    <section name="ReferenceCreate" loop="Tables">
              
    <sections>
                 
    <section name="ReferenceCreate1" loop="RefObjects">
    <![CDATA[alter table $FKTableName$
        add constraint FK_$FKTableName$_$PKTableName$ foreign key ($FKColumnName$)
            references $PKTableName$ ($PKColumnName$)
    go
    ]]>
                 
    </section>
              
    </sections>
              
    <body>
        
    <![CDATA[$ReferenceCreate1$]]>
              
    </body>
            
    </section>
            
    <section name="TableDelete" loop="Tables">
    <![CDATA[
    if exists (select 1
        from sysobjects
        where id = object_id('$TableName$')
        and type = 'U')
            drop table [$TableName$]
    go
    ]]>
            
    </section>
          
    </sections>
          
    <body>
            
    <![CDATA[
    -- =======================================================
    -- 本脚本由CodeBuilder工具生成
    -- 版权所有 (C) Faib Studio 2009
    --
    -- 创建人员: $Author$
    -- 创建时间: $Now$
    -- =======================================================

    -- Region 删除关系
    $ReferenceDelete$
    -- End Region

    -- Region 删除表
    $TableDelete$
    -- End Region

    -- Region 创建表
    $TableCreate$
    -- End Region

    -- Region 创建关系
    $ReferenceCreate$
    -- End Region
    ]]>
          
    </body>
        
    </part>
      
    </parts>
    </config>
  • 相关阅读:
    POJ 1330 Nearest Common Ancestors(LCA Tarjan算法)
    LCA 最近公共祖先 (模板)
    线段树,最大值查询位置
    带权并查集
    转负二进制
    UVA 11437 Triangle Fun
    UVA 11488 Hyper Prefix Sets (字典树)
    UVALive 3295 Counting Triangles
    POJ 2752 Seek the Name, Seek the Fame (KMP)
    UVA 11584 Partitioning by Palindromes (字符串区间dp)
  • 原文地址:https://www.cnblogs.com/faib/p/1658000.html
Copyright © 2011-2022 走看看