您的位置:首页 > 编程语言

动软代码生成与 EntityFramework 实体生成模板

2014-03-13 21:17 239 查看
有用到EntityFrameWork的同学们,可以用用。

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

/// <summary>
///<#= host.TableDescription #>
/// </summary>
[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>
[Column("<#= c.ColumnName #>")]
public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set; }
<# } #>

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐