CodeSmith生成实体类

匿名 (未验证) 提交于 2019-12-02 22:06:11
<%@ CodeTemplate Language="C#" TargetLanguage="C#" ResponseEncoding="UTF-8" Debug="False" Description="生成数据库实体" %> <%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="属性" Description="要生成实体的数据表" %> <%@ Property Name="NameSpace" Type="System.String" Optional="False" Default="Modul" Category="属性" Description="实体类所在的命名空间" %> <%@ Property Name="opuser" Type="System.String" Default="wlitsoft" Optional="False" Category="属性" Description="请输入您的名字" %> <%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %> <%@ Assembly Name="SchemaExplorer" %> <%@ Import Namespace="SchemaExplorer" %> /* *本代码由代码生成器自动生成,请不要更改此文件的任何代码。 *生成时间:<%= DateTime.Now.ToLocalTime() %> *生成者:<%= opuser %> */ using System; namespace <%= this.NameSpace %> {     ///<summary>     ///表<%= this.SourceTable.Name %>的实体类     ///</summary>     public class <%= this.SourceTable.Name %>     {         <%--生成私有字段.net2.0--%>         <% foreach (ColumnSchema column in this.SourceTable.Columns) {  %>         private <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToCamelCase(column.Name) %>;         <% } %>              <% foreach(ColumnSchema column in this.SourceTable.Columns){%>              <%--生成get set 方法--%>         /// <summary>         /// <%= column.Description %>         /// </summary>         public <%= CSharpAlias[column.SystemType.FullName] %> <%= StringUtil.ToPascalCase(column.Name) %>         {             get { return <%= StringUtil.ToCamelCase(column.Name) %>; }             set { <%= StringUtil.ToCamelCase(column.Name) %> = value; }         }         <%}%>              } }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!