CodeSmith 生成 数据库 数据表 对象
2010-01-08 15:09
337 查看
<%@ CodeTemplate Language="C#" TargetLanguage="C#" ResponseEncoding="UTF-8" Debug="False" Description="Creates a simplistic entity object." %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the stored procedures should be based on." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
using System;
using System.Runtime.Serialization;
namespace BE
{
/// <summary>
/// <%= SourceTable.Name %> 实体类
/// TerryFeng <%= DateTime.Now.ToString()%>
/// </summary>
[DataContract]
public class <%= SourceTable.Name %>
{
#region 私有成员
<% for (int i = 0; i < SourceTable.Columns.Count; i++) { %>
private <%= SourceTable.Columns[i].SystemType %> _<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %>;
<% } %>
#endregion
#region 数据契约属性
<% for (int i = 0; i < SourceTable.Columns.Count; i++) { %>
/// <summary>
/// <%= SourceTable.Columns[i].Description %>
/// </summary>
[DataMember]
public <%= SourceTable.Columns[i].SystemType %> <%= StringUtil.ToPascalCase(SourceTable.Columns[i].Name) %>
{
get
{
return this._<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %>;
}
set
{
this._<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %> = value;
}
}
<% } %>
#endregion
}
}
源代码下载:Templates.rar
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="Table that the stored procedures should be based on." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Import Namespace="SchemaExplorer" %>
using System;
using System.Runtime.Serialization;
namespace BE
{
/// <summary>
/// <%= SourceTable.Name %> 实体类
/// TerryFeng <%= DateTime.Now.ToString()%>
/// </summary>
[DataContract]
public class <%= SourceTable.Name %>
{
#region 私有成员
<% for (int i = 0; i < SourceTable.Columns.Count; i++) { %>
private <%= SourceTable.Columns[i].SystemType %> _<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %>;
<% } %>
#endregion
#region 数据契约属性
<% for (int i = 0; i < SourceTable.Columns.Count; i++) { %>
/// <summary>
/// <%= SourceTable.Columns[i].Description %>
/// </summary>
[DataMember]
public <%= SourceTable.Columns[i].SystemType %> <%= StringUtil.ToPascalCase(SourceTable.Columns[i].Name) %>
{
get
{
return this._<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %>;
}
set
{
this._<%= StringUtil.ToCamelCase(SourceTable.Columns[i].Name) %> = value;
}
}
<% } %>
#endregion
}
}
源代码下载:Templates.rar
相关文章推荐
- CodeSmith 生成 数据库 数据表 对象
- CodeSmith 生成 数据库 数据表 对象
- 一段由数据库结构生成相应数据对象的代码(1)(2) (3)--DataHelper
- 一段由数据库结构生成相应数据对象的代码(4)(5)
- SQLSERVER2000下生成数据库对象脚本(不包括数据信息)
- 转:SQLSERVER2000下生成数据库对象脚本(不包括数据信息)
- STATA 批量重命名,数据查重,行列转换,类型转换,变量截取和生成,数据库合并等命令
- PowerDesigner 数据库生成物理数据模型 生成数据库测试数据
- 使用postgreSQL DataSync 进行pg数据库升级 数据同步 升级脚本生成, postgreSQL DataSync简单教程
- 使用postgreSQL DataSync 进行pg数据库升级 数据同步 升级脚本生成, postgreSQL DataSync简单教程
- 使用postgreSQL DataSync 进行pg数据库升级 数据同步 升级脚本生成, postgreSQL DataSync简单教程
- asp.net数据库生成LigerUi树Tree结构Json格式数据(有点绕,附基本源代码)
- JPA学习笔记---JPA实体Bean的建立+配置文件+junit测试+自动生成(对应实体Bean的)数据库表+插入数据
- ORACLE 数据库的统计数据及其生成方式
- 上传Excel数据到数据库中(Asp.net自动生成三层代码 第六集 )
- CodeSmith----02.生成数据库表对应实体
- CodeSmith 模板支持access 数据库,生成三层架构
- SQL Server 实例每个数据库的数据表个数受数据库中的对象个数限制
- 为数据库中所有的用户数据表生成分页存储过程
- 数据库生成脚本,架构+数据