点这里进入ABP入门教程目录 

在应用层(即JD.CRS.Application)下创建文件夹Course //用以存放Course相关应用服务

在JD.CRS.Application/Course下创建文件夹Dto //用以存放Course相关数据传输对象

创建数据传输对象

在JD.CRS.Application/Course/Dto下创建两个Dto

只读对象

CourseDto.cs //用于查询Course对象

贴上AutoMapFrom的特性

[AutoMapFrom(typeof(Entitys.Course))]

 1 using Abp.Application.Services.Dto;
 2 using Abp.AutoMapper;
 3 using System;
 4 using System.ComponentModel.DataAnnotations;
 5 
 6 namespace JD.CRS.Course.Dto
 7 {
 8 
 9     [AutoMapFrom(typeof(Entitys.Course))]
10     public class CourseDto : EntityDto<int>
11     {
12         /// <summary>
13         /// 课程编号
14         /// </summary>
15         [StringLength(50)]
16         public string Code { get; set; }
17         /// <summary>
18         /// 院系编号
19         /// </summary>
20         [StringLength(50)]
21         public string DepartmentCode { get; set; }
22         /// <summary>
23         /// 课程名称
24         /// </summary>
25         [StringLength(150)]
26         public string Name { get; set; }
27         /// <summary>
28         /// 课程积分
29         /// </summary>
30         [Range(0, 5)]
31         public int Credits { get; set; }
32         /// <summary>
33         /// 备注
34         /// </summary>
35         [StringLength(200)]
36         public string Remarks { get; set; }
37         /// <summary>
38         /// 状态: 0 正常, 1 废弃
39         /// </summary>
40         public int? Status { get; set; }
41         /// <summary>
42         /// 创建日期
43         /// </summary>
44         public DateTime? CreateDate { get; set; }
45         /// <summary>
46         /// 创建人
47         /// </summary>
48         [StringLength(50)]
49         public string CreateName { get; set; }
50         /// <summary>
51         /// 修改日期
52         /// </summary>
53         public DateTime? UpdateDate { get; set; }
54         /// <summary>
55         /// 修改人
56         /// </summary>
57         [StringLength(50)]
58         public string UpdateName { get; set; }
59 
60         public DateTime CreationTime { get; set; }
61     }
62 }
View Code

相关文章:

  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-02-06
  • 2021-07-28
  • 2021-12-10
猜你喜欢
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2021-08-04
相关资源
相似解决方案