1. 程式人生 > >model類生成模板

model類生成模板

.com lse field n) sha ext del list sin

<#@ template language="c#" HostSpecific="True" #>
<#@ output extension= ".cs" #>
<#
	TableHost host = (TableHost)(Host);
	host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
#>
using System;
namespace <#= host.NameSpace #><# if( host.Folder.Length > 0) {#>.<#= host.Folder #><# } #>

{
	<# if( host.TableDescription.Length > 0) {#>//<#= host.TableDescription #>
	<# } #>public class <#= host.GetModelClass(host.TableName).Replace("Sys_","")+"Entity" #>: IEntity<<#= host.GetModelClass(host.TableName).Replace("Sys_","")+"Entity" #>>, ICreationAudited, IDeleteAudited, IModificationAudited
	{		
      	<# foreach (ColumnInfo c in host.Fieldlist)
		{ #>/// <summary>
		/// <#= string.IsNullOrEmpty(c.Description) ? c.ColumnName : c.Description #>
        /// </summary>
        <#if(CodeCommon.DbTypeToCS(c.TypeName)=="bool" || CodeCommon.DbTypeToCS(c.TypeName)=="DateTime"){#>private <#= CodeCommon.DbTypeToCS(c.TypeName) #>? _<#= c.ColumnName.ToString().ToLower() #>;
		public <#= CodeCommon.DbTypeToCS(c.TypeName) #>? <#= c.ColumnName #>
		<#}else{#>private <#= CodeCommon.DbTypeToCS(c.TypeName) #> _<#= c.ColumnName.ToString().ToLower() #>;
		public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>
		<#}#>{
            get{ return _<#= c.ColumnName.ToString().ToLower()#>; }
            set{ _<#= c.ColumnName.ToString().ToLower() #> = value; }
        }        
		<# } #>
   
	}
}

  

model類生成模板