zoukankan      html  css  js  c++  java
  • CodeSmith6.5 Model

    <%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Description="Template description here." %>
    <%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema"  Category="Context"  Optional="True" Description="the table name"   %>
    <%@ Assembly Name="SchemaExplorer" %>
    <%@ Import Namespace="SchemaExplorer" %>
    <%@ Assembly Name="CodeSmith.BaseTemplates" %>
    <%@ Import Namespace="CodeSmith.BaseTemplates" %>
    <%@ Assembly Name="CodeSmith.CustomProperties" %>
    <%@ Import Namespace="CodeSmith.CustomProperties" %>
    <%@ Map Name="DbTypeCSharp" Src="DbType-CSharp" Description="DbType to CSharp Map" %>
    
    <script runat="template">
        public string GetCSharpVariableType(ColumnSchema column)
        {
            if (column.Name.EndsWith("TypeCode")) return column.Name;
    
            return DbTypeCSharp[column.DataType.ToString()];    
        }
    </script>
    <%for(int i=0; i<this.SourceTable.Columns.Count-1;i++)
    {                   
        string colName=this.SourceTable.Columns[i].Name;%>
        /// <summary>
        /// <%=this.SourceTable.Columns[i].Description.Replace("
    ","") %>
        /// </summary>
        public  <%=GetCSharpVariableType(this.SourceTable.Columns[i])%> <%=colName.Substring(0,1).ToUpper()%><%=colName.Substring(1,colName.Length-1)%>{set;get;}
    <%}%>
    <%string colName2=this.SourceTable.Columns[this.SourceTable.Columns.Count-1].Name; %> 
        /// <summary>
        /// <%=this.SourceTable.Columns[this.SourceTable.Columns.Count-1].Description %>
        /// </summary>
        public  <%=GetCSharpVariableType(this.SourceTable.Columns[this.SourceTable.Columns.Count-1])%> <%=colName2.Substring(0,1).ToUpper()%><%=colName2.Substring(1,colName2.Length-1)%>{set;get;}
  • 相关阅读:
    UML用例图
    Google Map API 文档
    chrome 使用各种搜索引擎的方法 GIS
    javaScript 获得触发事件的元素 支持IE FireFox GIS
    html 的路径 GIS
    JavaScript prototype GIS
    chromium 的资源管理 的grit GIS
    [原]使用ucenter最土团购整合DX2bbs的心得
    [转]sqlserver日期函数
    最土Ajax实现/json
  • 原文地址:https://www.cnblogs.com/xinzheng/p/4488171.html
Copyright © 2011-2022 走看看