CodeSmith 生成实体类模版

 

ExpandedBlockStart.gif 代码
<%--  
Name: 数据库实体类
Author: B哥
Description: 数据库实体类
--%>
<% @ 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 "  Default = " WanerSoft.Model "  Optional = " False "  Category = " 属性 "  Description = " 实体类所在的命名空间 "   %>
<% @ Property Name = " opuser "  Type = " System.String "  Default = ""  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  %>
    {
        
<%   foreach  (ColumnSchema column  in   this .SourceTable.Columns) {   %>
        
        
private   <%=  CSharpAlias[column.SystemType.FullName]  %>  _ <%=  StringUtil.ToCamelCase(column.Name)  %> ;
        
///   <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; }
        }
        
        
<%  }  %>
    }
}

 

 

转载于:https://www.cnblogs.com/kuibono/articles/1620188.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值