ldj/codeSmith/bakcup/WCFdata.cst

97 lines
2.8 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.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using DeiNiu.wms.Data.Model;
namespace DeiNiu.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() %> () {
}
#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)) {%>
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)) {%>
wcfObj.<%= column.Name%> = dbObj.<%= column.Name%>;
<% } %>
<% } %>
return wcfObj;
}
}
#endregion
}