Home > Web Front-end > JS Tutorial > body text

How does CodeSmith generate entity classes?

云罗郡主
Release: 2018-10-15 14:32:46
forward
1524 people have browsed it

The content this article brings to you is about how CodeSmith generates entity classes. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

<%@ 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; }
        }        <%}%>
        
    }
}
Copy after login

The above is the complete introduction to PHP. If you want to know more about JavaScript video tutorial, please pay attention to the PHP Chinese website.

The above is the detailed content of How does CodeSmith generate entity classes?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!