132 lines
4.7 KiB
Plaintext
132 lines
4.7 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>
|
|
///WCF Data Object
|
|
///BASIC CLASS FOR TABLE <%=this.SourceTable.Name%>
|
|
///By wm
|
|
///on <%= DateTime.Now.ToString("MM/dd/yyyy")%>
|
|
/// </summary>
|
|
|
|
using System;
|
|
using System.Runtime.Serialization;
|
|
using System.Data;
|
|
namespace DeiNiu.wms.Data.Model.Wcf
|
|
{
|
|
|
|
#region <%=getWcfClassName() %>
|
|
/// <summary>
|
|
/// This object represents the properties and methods of a <%=getWcfClassName() %>.
|
|
/// </summary>
|
|
[DataContract]
|
|
public class <%=getWcfClassName() %> {
|
|
|
|
<%
|
|
foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
<%=getInternalDelcare4wcf(column) %>
|
|
<%
|
|
}
|
|
%>
|
|
|
|
public <%=getWcfClassName() %> () {
|
|
}
|
|
|
|
public <%=getWcfClassName() %> (DataRow dr) {
|
|
#region get data from dr
|
|
if (dr != null )
|
|
{
|
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
if (dr.Table.Columns.Contains("<%= column.Name.ToString() %>") && !(dr["<%= column.Name.ToString() %>"] is DBNull))
|
|
{
|
|
<%= "_"+ column.Name %> = <% if(column.DataType.ToString().Equals("String") || column.DataType.ToString().Equals("AnsiString") || column.DataType.ToString().Equals("DateTime") || column.DataType.ToString().Equals("Date") ) {%> dr["<%= column.Name.ToString() %>"].ToString() <% } else {%> Convert.To<%= column.DataType %>(dr["<%= column.Name.ToString() %>"].ToString()); <% } %>;
|
|
}
|
|
<%
|
|
}
|
|
%>
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
public <%=getWcfClassName() %>( <%=getObjClassNameExt() %> dbObj){
|
|
#region get data from dbobj
|
|
|
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
<% if(!isIgnoredProperty4wc(column)) {%>
|
|
<% if(column.Name.ToString().ToUpper().Equals("ID")){
|
|
%> _id= dbObj.ID;<%
|
|
} else{%>
|
|
<%= column.Name%> = dbObj.<%= column.Name%>;
|
|
<%}} %>
|
|
<% } %>
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
|
|
|
|
#region Public Properties
|
|
<%
|
|
foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
<% //if(!isIgnoredProperty4wc(column)) {%>
|
|
|
|
[DataMember]
|
|
public <%=getType(column) %> <%= column.Name%>{
|
|
get {return _<%= column.Name%>;}
|
|
set {_<%= column.Name%> = value;}
|
|
}
|
|
|
|
<% //} %>
|
|
<% } %>
|
|
|
|
#endregion
|
|
|
|
public <%=getObjClassNameExt() %> getDbObject(){
|
|
|
|
<%=getObjClassNameExt() %> dbObj = new <%=getObjClassNameExt() %>(id);
|
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
<% if(!isIgnoredProperty4wc(column)) {%>
|
|
<% if(column.Name.ToString().ToUpper().Equals("ID")){
|
|
%>dbObj.ID= id ;<%
|
|
} else{%>
|
|
dbObj.<%= column.Name%> = <%= column.Name%>;
|
|
<% }}%>
|
|
<% } %>
|
|
|
|
return dbObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
public <%=getWcfClassName() %> getWcfObject( <%=getObjClassNameExt() %> dbObj){
|
|
|
|
<%=getWcfClassName() %> wcfObj = new <%=getWcfClassName() %>();
|
|
<% foreach (ColumnSchema column in this.SourceTable.Columns) { %>
|
|
<% if(!isIgnoredProperty4wc(column)) {%>
|
|
<% if(column.Name.ToString().ToUpper().Equals("ID")){
|
|
%> wcfObj.id= dbObj.ID;<%
|
|
} else{%>
|
|
wcfObj.<%= column.Name%> = dbObj.<%= column.Name%>;
|
|
<%}} %>
|
|
<% } %>
|
|
|
|
return wcfObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
}
|