动软生成Model(dapper.common)

<#@ template language="c#" HostSpecific="True" #>
<#@ output extension= ".cs" #>
<#
TableHost host = (TableHost)(Host);
host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
#>
using Dapper.Common;
using System;
using System.Collections.Generic;
using System.Text;
namespace Review.Model.AccountModel
{
<# 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>
<# if (c.IsPrimaryKey)
{#>
[Column(name: "<#=c.ColumnName#>", key: ColumnKey.Primary, isIdentity: true, isColumn: true)]
<#}
else{
#>
[Column(name: "<#=c.ColumnName#>")]
<#}#>
public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get; set; }

<# } #>


}
}

猜你喜欢

转载自www.cnblogs.com/tonglei/p/11245873.html