CodeSmith 生成 数据库 数据表 对象

<%@ 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值