不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
CodeSmith数据表实体类生成模板
编辑:dnawo 日期:2009-07-14
复制内容到剪贴板
程序代码

<%@ CodeTemplate Language="C#" TargetLanguage="C#" %>
<%@ Property Name="NameSpace" Type="String" Category="Context" %>
<%@ Property Name="Table" Type="SchemaExplorer.TableSchema" Category="Context" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
//首字母小写
public string LCase(string text)
{
return text.Substring(0,1).ToLower() + text.Substring(1);
}
//首字母大写
public string UCase(string text)
{
return text.Substring(0,1).ToUpper() + text.Substring(1);
}
</script>
////////////////////////////////////////////////
// File: <% =UCase(Table.Name) %>Info.cs
// Description: Enter summary here after generation.
// Date: <% =DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") %>
// Web: http://www.mzwu.com/
////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace <% =NameSpace %>
{
public class <% =UCase(Table.Name) %>Info
{
<%-- 私有字段 --%>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
private <% =Table.Columns[i].SystemType.Name %> _<% =LCase(Table.Columns[i].Name) %>;
<% }%>
<%-- 属性 --%>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
/// <summary>
/// <% =Table.Columns[i].Description %>
/// </summary>
public <% =Table.Columns[i].SystemType.Name %> <% =UCase(Table.Columns[i].Name) %>
{
get {return _<% =LCase(Table.Columns[i].Name) %>;}
set {_<% =LCase(Table.Columns[i].Name) %> = value;}
}
<% }%>
<%-- 构造函数 --%>
/// <summary>
/// 构造函数
/// </summary>
public <% =UCase(Table.Name) %>Info()
{}
/// <summary>
/// 构造函数
/// </summary>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
/// <param name="<% =LCase(Table.Columns[i].Name) %>"><% =Table.Columns[i].Description %></param>
<% }%>
public <% =UCase(Table.Name) %>Info
(
<% for(int i=0;i<Table.Columns.Count;i++) {%>
<% =Table.Columns[i].SystemType.Name %> <% =LCase(Table.Columns[i].Name) %><% if(i<Table.Columns.Count-1)Response.Write(","); %>
<% }%>
)
{
<% for(int i=0;i<Table.Columns.Count;i++) {%>
_<% =LCase(Table.Columns[i].Name) %> = <% =LCase(Table.Columns[i].Name) %>;
<% }%>
}
}
}
<%@ Property Name="NameSpace" Type="String" Category="Context" %>
<%@ Property Name="Table" Type="SchemaExplorer.TableSchema" Category="Context" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
<script runat="template">
//首字母小写
public string LCase(string text)
{
return text.Substring(0,1).ToLower() + text.Substring(1);
}
//首字母大写
public string UCase(string text)
{
return text.Substring(0,1).ToUpper() + text.Substring(1);
}
</script>
////////////////////////////////////////////////
// File: <% =UCase(Table.Name) %>Info.cs
// Description: Enter summary here after generation.
// Date: <% =DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") %>
// Web: http://www.mzwu.com/
////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace <% =NameSpace %>
{
public class <% =UCase(Table.Name) %>Info
{
<%-- 私有字段 --%>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
private <% =Table.Columns[i].SystemType.Name %> _<% =LCase(Table.Columns[i].Name) %>;
<% }%>
<%-- 属性 --%>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
/// <summary>
/// <% =Table.Columns[i].Description %>
/// </summary>
public <% =Table.Columns[i].SystemType.Name %> <% =UCase(Table.Columns[i].Name) %>
{
get {return _<% =LCase(Table.Columns[i].Name) %>;}
set {_<% =LCase(Table.Columns[i].Name) %> = value;}
}
<% }%>
<%-- 构造函数 --%>
/// <summary>
/// 构造函数
/// </summary>
public <% =UCase(Table.Name) %>Info()
{}
/// <summary>
/// 构造函数
/// </summary>
<% for(int i=0;i<Table.Columns.Count;i++) {%>
/// <param name="<% =LCase(Table.Columns[i].Name) %>"><% =Table.Columns[i].Description %></param>
<% }%>
public <% =UCase(Table.Name) %>Info
(
<% for(int i=0;i<Table.Columns.Count;i++) {%>
<% =Table.Columns[i].SystemType.Name %> <% =LCase(Table.Columns[i].Name) %><% if(i<Table.Columns.Count-1)Response.Write(","); %>
<% }%>
)
{
<% for(int i=0;i<Table.Columns.Count;i++) {%>
_<% =LCase(Table.Columns[i].Name) %> = <% =LCase(Table.Columns[i].Name) %>;
<% }%>
}
}
}
评论: 0 | 引用: 0 | 查看次数: 4595
发表评论
请登录后再发表评论!