ModelTemplate.tt
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
using System;
using SqlSugar;
namespace Hh.Mes.POJO.Entity
{
/// <summary>
/// <#=TableDescription #>
/// </summary>
[SugarTable("<#=TableName #>")]
public partial class <#=TableName #>:base_Entity
{
<# foreach (var item in TableColumnInfos) #>
<# { #>
<# if (item.ColumnName.Equals("id",StringComparison.OrdinalIgnoreCase)) #>
<# { #>
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
<# } #>
<# else { if (!string.IsNullOrWhiteSpace(item.ColumnDescription)) #>
<# { #>
/// <summary>
/// <#=item.ColumnDescription #>
/// </summary>
<# } #>
[SugarColumn(<#= item.TypeName.Equals("string", StringComparison.OrdinalIgnoreCase) ? $"Length = {item.TypeLenght}, " : "" #><#= string.IsNullOrWhiteSpace(item.ColumnDescription) ? "" : $"ColumnDescription = \"{item.ColumnDescription}\", " #>IsNullable = <#= item.NullAble ? "true" : "false" #>)]
<# } #>
public <#=item.TypeName #> <#=item.ColumnName #> { get; set; }
<# } #>
}
}