CodeSmith生成SQL数据库视图的实体类脚本_SQL SERVER数据库_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

CodeSmith生成SQL数据库视图的实体类脚本

作者:黑客防线网安SQL维护基地 来源:黑客防线网安SQL维护基地 浏览次数:0

本篇关键词:实体脚本数据库生成
黑客防线网安网讯:  第一个文件是businessobjctforView.cst,生成C#实体类,此脚本需要引用第二个文件CommonUtility.cs。需将两个文件放在同一目录中。<%@PropertyName="SourceTable"Type="SchemaExplorer....

  第一个文件是businessobjctforView.cst生成C#实体类此脚本需要引用第二个文件CommonUtility.cs需将两个文件放在同一目录中

<SQL'>%@CodeTemplateLanguage="C#"TargetLanguage="T-SQL"
   Description="Generatesaupdatestoredprocedure."%>
<%@AssemblyName="SchemaExplorer"%>
<%@ImportNamespace="SchemaExplorer"%>
<%@PropertyName="SourceTable"Type="SchemaExplorer.ViewSchema"
   Category="Context"
   Description="Tablethatthestoredproceduresshouldbebasedon."%>
<%@AssemblySrc="CommonUtility.cs"%>
<%@ImportNamespace="Common.Data"%>
<scriptrunat="template">
  CommonUtilityrule=newCommonUtility();
</script>
usingSystem;
usingSystem.Collections;
usingSystem.Collections.Generic;
usingSystem.Data;                                                                            
namespaceSOA.Model
{
  ///<summary>
  ///<%=SourceTable.Name%>objectforViewtable'<%=SourceTable.Name%>'.
  ///</summary>
  [Serializable]
  publicclass<%=SourceTable.Name%>
  {
  #regionPrivateMember
    <%for(inti=0;i<SourceTable.Columns.Count;i++){%>
    private<%=rule.GetCSharpVariableType(SourceTable.Columns[i])%>_<%=SourceTable.Columns[i].Name%>;
  <%}%>
  #endregion
    
  #regionConstructor
    public<%=SourceTable.Name%>(){}    
    
    public<%=SourceTable.Name%>(
        <%for(inti=0;i<SourceTable.Columns.Count-1;i++){%>
    <%=rule.GetCSharpVariableType(SourceTable.Columns[i])%><%=SourceTable.Columns[i].Name%>,  
  <%}%>
  <%=rule.GetCSharpVariableType(SourceTable.Columns[SourceTable.Columns.Count-1])%><%=SourceTable.Columns[SourceTable.Columns.Count-1].Name%>
    )
    {
    <%for(inti=0;i<SourceTable.Columns.Count;i++){%>
    _<%=SourceTable.Columns[i].Name%>=<%=SourceTable.Columns[i].Name%>;
  <%}%>
    }
  #endregion
  
  #regionPublicProperties
  <%for(inti=0;i<SourceTable.Columns.Count;i++){%>
    public<%=rule.GetCSharpVariableType(SourceTable.Columns[i])%><%=rule.GetCamelCaseName(SourceTable.Columns[i].Name)%>
    {
      get{return_<%=SourceTable.Columns[i].Name%>;}
      set{_<%=SourceTable.Columns[i].Name%>=value;}
    }
  <%}%>
  #endregion
  }
}

    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-9691-1.html
网站维护教程更新时间:2012-03-21 02:24:03  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer