UpdateDto.tt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. namespace <#=Model.ApplicationNamespace#>.Dto
  11. {
  12. <#
  13. if(!string.IsNullOrEmpty(Model.HtmlPageTitle)){
  14. #>
  15. /// <summary>
  16. /// <#=Model.HtmlPageTitle#>
  17. /// </summary>
  18. <# }
  19. #> [AutoMapTo(typeof(<#=Model.ClassName#>))]
  20. public class <#=Model.ClassName#>UpdateDto: EntityDto<<#=Model.IdType#>>
  21. {
  22. <#
  23. foreach (var item in Model.Columns)
  24. {
  25. if(!item.IsGenreated) continue;
  26. if(!string.IsNullOrEmpty(item.Comment)){
  27. #>
  28. /// <summary>
  29. /// <#=item.Comment#>
  30. /// </summary>
  31. <# }
  32. if (item.IsRequired)
  33. {
  34. #> [Required]
  35. <# }
  36. var maxLength="";
  37. if (item.IsVarchar && !string.IsNullOrEmpty(item.MaxLength))
  38. {
  39. maxLength=item.MaxLength.StartsWith(".")?Model.ClassName+item.MaxLength:item.MaxLength;
  40. }
  41. if(!string.IsNullOrEmpty(maxLength))
  42. {
  43. #> [StringLength(<#=maxLength#>)]
  44. <# }
  45. #> public <#=item.AttrType#> <#=item.ColumnName#> { get; set; }
  46. <#
  47. }
  48. #>
  49. }
  50. }