动软生成器添加Mysql注释

时间:2021-10-15 18:32:44

1.解决没有mysql注释问题

替换原文件下载地址

2.更新Models模板

<#@ template language="c#" HostSpecific="True" #>
<#@ output extension= ".cs" #>
<#
    TableHost host = (TableHost)(Host);
    host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
#>
using Dapper.Extension;
using System; 
using System.Text;
using System.Collections.Generic; 
using System.Data;
using Newtonsoft.Json;
namespace <#= host.NameSpace #>.Models<# if( host.Folder.Length > 0) {#>.<#= host.Folder #><# } #>
{
    <# if( host.TableDescription.Length > 0) {#>
     //<#= host.TableDescription #>
    <# } #>
    [Table("<#= host.GetModelClass(host.TableName) #>")]
    public class <#= host.GetModelClass(host.TableName) #>
    {
                
          <# foreach (ColumnInfo c in host.Fieldlist)
        { #>
        /// <summary>
        /// <#= string.IsNullOrEmpty(c.Description)  ? c.ColumnName : c.Description #>
        /// </summary>        
        [JsonProperty("<#= c.ColumnName.ToString().ToLower() #>")]
        public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName.Substring(0,1).ToUpper() c.ColumnName.Substring(1) #>{ get; set; }
        <# } #>
   
    }
}

转载:https://www.cnblogs.com/Jerrycjc/p/9176885.html