ldj/codeSmith/template/basicObject.cst

81 lines
2.3 KiB
Plaintext

<%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="This template demonstrates using properties defined in external assemblies." %>
<%@ Property Name="SourceDatabase" Type="SchemaExplorer.DatabaseSchema" Category="Context" Description="Database that the documentation should be based on." %>
<%@ 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">
<!-- #include file="scripts.cs" -->
</script>
/// <summary>
///Data Object
///BASIC CLASS FOR TABLE <%=this.SourceTable.Name%>
///By wm
///on <%= DateTime.Now.ToString("MM/dd/yyyy")%>
/// </summary>
using System;
using System.Data;
using DeiNiu.Data.BaseObject;
namespace DeiNiu.wms.Data.Model
{
#region <%=getObjClassName() %>
/// <summary>
/// This object represents the properties and methods of a <%=getObjClassName() %>.
/// </summary>
[Serializable]
public class <%=getObjClassName() %> : BaseModel {
<%
foreach (ColumnSchema column in this.SourceTable.Columns) { %>
<%=getInternalDelcare(column) %>
<%
}
%>
public <%=getObjClassName() %> () {
}
public <%=getObjClassName() %> (int id) {
_id=id;
getModel();
}
public <%=getObjClassName() %>(DataRow dr)
{
getModel(dr);
}
public <%=getObjClassName() %>(System.Data.SqlClient.SqlConnection _Conn)
: base(_Conn)
{
}
protected override void getImp()
{
model_imp = new <%= getObjClassName() %>_Imp();
}
#region Public Properties
<%
foreach (ColumnSchema column in this.SourceTable.Columns) { %>
<% if(!column.Name.ToString().ToUpper().Equals("ID")) {%>
public <%=getType(column) %> <%= column.Name%>{
get {return _<%= column.Name%>;}
<% if(!isIgnored4Property(column)) {%> set {_<%= column.Name%> = value;} <% } %>
}
<% } %>
<% } %>
#endregion
#region fieldNames
public enum fields{<%=getColums4Enum()%>}
#endregion
}
#endregion
}