Model-2017.cmt 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. <#@ template language="c#" HostSpecific="True" #>
  2. <#@ output extension= ".cs" #>
  3. <#
  4. TableHost host = (TableHost)(Host);
  5. host.Fieldlist.Sort(CodeCommon.CompareByintOrder);
  6. #>
  7. <# if( host.TableDescription.Length > 0) {#>
  8. //<#= host.TableDescription #>
  9. <# } #>
  10. public class <#= host.GetModelClass(host.TableName) #>
  11. {
  12. <# foreach (ColumnInfo c in host.Fieldlist)
  13. { #>
  14. /// <summary>
  15. /// <#= string.IsNullOrEmpty(c.Description) ? c.ColumnName : c.Description #>
  16. /// </summary>
  17. <# if (CodeCommon.DbTypeToCS(c.TypeName) == "string") {#>
  18. public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set;} = "";
  19. <#} else if (CodeCommon.DbTypeToCS(c.TypeName) == "int" || CodeCommon.DbTypeToCS(c.TypeName) == "long" ) {#>
  20. public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set;} = 0;
  21. <#} else if (CodeCommon.DbTypeToCS(c.TypeName) == "float" || CodeCommon.DbTypeToCS(c.TypeName) == "double" ) {#>
  22. public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set;} = 0.0;
  23. <#} else if (CodeCommon.DbTypeToCS(c.TypeName) == "DateTime" ) {#>
  24. public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set;}
  25. <#} else {#>
  26. public <#= CodeCommon.DbTypeToCS(c.TypeName) #> <#= c.ColumnName #>{ get;set;}
  27. <# } #>
  28. <# } #>
  29. }