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;}
  • 相关阅读:
    matplotlib数据可视化之柱形图
    xpath排坑记
    Leetcode 100. 相同的树
    Leetcode 173. 二叉搜索树迭代器
    Leetcode 199. 二叉树的右视图
    Leetcode 102. 二叉树的层次遍历
    Leetcode 96. 不同的二叉搜索树
    Leetcode 700. 二叉搜索树中的搜索
    Leetcode 2. Add Two Numbers
    Leetcode 235. Lowest Common Ancestor of a Binary Search Tree
  • 原文地址:https://www.cnblogs.com/xinzheng/p/4488171.html
Copyright © 2011-2022 走看看