UpdateDto.tt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <#@ template language="C#" #>
  2. <#@ assembly name="System.Core" #>
  3. <#@ import namespace="System.Linq" #>
  4. <#@ import namespace="System.Text" #>
  5. <#@ import namespace="System.Collections.Generic" #>
  6. using System;
  7. using Abp.AutoMapper;
  8. using Abp.Application.Services.Dto;
  9. using System.ComponentModel.DataAnnotations;
  10. using IwbZeroCore.Zero;
  11. namespace <#=Model.ApplicationNamespace#>.Dto
  12. {
  13. <#
  14. if(!string.IsNullOrEmpty(Model.HtmlPageTitle)){
  15. #>
  16. /// <summary>
  17. /// <#=Model.HtmlPageTitle#>
  18. /// </summary>
  19. <# }
  20. #> [AutoMapTo(typeof(<#=Model.ClassName#>))]
  21. public class <#=Model.FileName#>UpdateDto: EntityDto<<#=Model.IdType#>>
  22. {
  23. <#
  24. foreach (var item in Model.Columns)
  25. {
  26. if(!item.IsGenreated) continue;
  27. if(!string.IsNullOrEmpty(item.Comment)){
  28. #>
  29. /// <summary>
  30. /// <#=item.Comment#>
  31. /// </summary>
  32. <# }
  33. if (item.IsRequired)
  34. {
  35. #> [Required]
  36. <# }
  37. var maxLength="";
  38. if (item.IsVarchar && !string.IsNullOrEmpty(item.MaxLength))
  39. {
  40. maxLength=item.MaxLength.StartsWith(".")?Model.ClassName+item.MaxLength:item.MaxLength;
  41. }
  42. if(!string.IsNullOrEmpty(maxLength))
  43. {
  44. #> [StringLength(<#=maxLength#>)]
  45. <# }
  46. #> public <#=item.AttrType#> <#=item.ColumnName#> { get; set; }
  47. <#
  48. }
  49. #>
  50. }
  51. }