ldj/codeSmith/template/extModelClass.cst

58 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-05-23 16:13:17 +08:00
<%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="This template demonstrates using properties defined in external assemblies." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="The table to use for this sample." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
public string getObjClassName()
{
string tablename = this.SourceTable.Name.Substring(2);
string firstChar = tablename.Substring(0,1);
string className = firstChar.ToUpper() + tablename.Substring(1);
return className ;
}
</script>
/// <summary>
///INTERFACE CLASS FOR TABLE <%=this.SourceTable.Name%>
///By wm
///on <%= DateTime.Now.ToString("MM/dd/yyyy")%>
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace DeiNiu.wms.Data.Model
{
[Serializable]
public class <%= getObjClassName() %> : <%= getObjClassName() %>_base
{
public <%= getObjClassName() %>()
{
}
public <%= getObjClassName() %>(int id): base(id)
{
}
public <%= getObjClassName() %>(DataRow dr): base(dr)
{
}
protected override void getImp()
{
model_imp = new <%= getObjClassName() %>_Imp();
}
//begin cust db operation, query, excute sql etc.
public DataSet QueryByName(string name)
{
cmdParameters[0] = name;
return CustQuery(100);
}
}
}