zoukankan      html  css  js  c++  java
  • 模板:循环数据库表

    模板是C#语法的 .cst文件

    <%@ CodeTemplate Language="C#" TargetLanguage="Text" ResponseEncoding="UTF-8" Src="" Inherits="" Debug="False" CompilerVersion="v3.5" Description="Template description here." %>
    <%@ Property Name="ModelClassNameSpace" Type="System.String" Default="ModelClassNameSpace" Optional="False" Category="Strings" Description="This is ModelClassNameSpace"%>
    <%@ Assembly Name="SchemaExplorer" %>
    <%@ Import Namespace="SchemaExplorer" %>
    <%@ Import Namespace="System.Windows.Forms.Design" %>
    <%@ Import Namespace="System.Drawing.Design" %>
    <%@ Import Namespace="System.IO" %>
    
    <script runat="template">
    
    private DatabaseSchema _sourceDatabase;
    [Category("Database")]
    [Description("This is a DatabaseSource")]
    public DatabaseSchema SourceDatabase
    {
        get{return this._sourceDatabase;}
        set{_sourceDatabase= value;}
    }
    
    //设置类文件名称
    public string GetClassName(TableSchema table)
    {
        //if (table.Name.EndsWith("s"))
        //{
            //return table.Name.Substring(0, table.Name.Length - 1) + "Entity";
        //}
        //else
        //{
        //    return table.Name+"Entity";
        //}
        return FormatTable(table.Name);
    }
    //格式化表名
    public string FormatTable(string param)
    {
    	string[] p =param.Split('_');
    	return p[p.Length-1].ToString();
    }
    </script>
    <%
    foreach(TableSchema table in _sourceDatabase.Tables)
    {
        %>
        //<%=table.Description%>
        kernel.Bind<ADT.Eppendorf.IBLL.APP.I<%=FormatTable(table.Name)%>>().To<ADT.Eppendorf.BLL.APP.<%=FormatTable(table.Name)%>>();
        kernel.Bind<ADT.Eppendorf.IDAL.APP.I<%=FormatTable(table.Name)%>>().To<ADT.Eppendorf.DAL.APP.<%=FormatTable(table.Name)%>>();
        <%
    }
    %>
    

      

  • 相关阅读:
    分数序列规律求和
    猴子吃桃算法
    猴子吃桃算法
    完数
    完数
    数字个数依次叠加 s=a+aa+aaa+aaaa+aa...a
    数字个数依次叠加 s=a+aa+aaa+aaaa+aa...a
    hbase(二)Java操作 hbase
    hbase scan startrow endrow 是否包括
    ListOrderedMap和Map
  • 原文地址:https://www.cnblogs.com/xsj1989/p/5234658.html
Copyright © 2011-2022 走看看