zoukankan      html  css  js  c++  java
  • 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

    冯瑞涛
  • 相关阅读:
    使用CSS画三角形
    Hello World!
    python学习四(处理数据)
    python学习三(数据保存到文件)
    python学习二(文件与异常)
    python学习一(Python中的列表)
    Hadoop 解除 “Name node is in safe mode”(转)
    Java NIO开发需要注意的陷阱(转)
    Java NIO基本使用介绍
    如何设计企业移动应用 by宋凯
  • 原文地址:https://www.cnblogs.com/finehappy/p/1654970.html
Copyright © 2011-2022 走看看