欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ABP开发手记6 - 领域层创建实体

程序员文章站 2023-08-23 13:09:30
点这里进入ABP开发手记目录 创建实体 在领域层(即JD.CRS.Core)下新建文件夹Entitys //用以存放实体对象添加一个实体类Course.cs //课程信息 1 using Abp.Domain.Entities; 2 using Abp.Domain.Entities.Auditin ......

点这里进入abp开发手记目录 

创建实体

在领域层(即jd.crs.core)下新建文件夹entitys //用以存放实体对象
添加一个实体类course.cs //课程信息

 1 using abp.domain.entities;
 2 using abp.domain.entities.auditing;
 3 using abp.timing;
 4 using system;
 5 using system.collections.generic;
 6 using system.componentmodel.dataannotations;
 7 using system.componentmodel.dataannotations.schema;
 8 
 9 namespace jd.crs.entitys
10 {
11     public class course : entity<int>, ihascreationtime
12     {
13         public course()
14         {
15             this.code = string.empty;
16             this.departmentcode = string.empty;
17             this.name = string.empty;
18             this.credits = 0;
19             this.remarks = string.empty;
20             this.status = 0;
21             this.createdate = null;
22             this.createname = string.empty;
23             this.updatedate = null;
24             this.updatename = string.empty;
25             this.creationtime = clock.now;
26         }
27         /// <summary>
28         /// 课程编号
29         /// </summary>
30         [stringlength(50)]
31         public string code { get; set; }
32         /// <summary>
33         /// 院系编号
34         /// </summary>
35         [stringlength(50)]
36         public string departmentcode { get; set; }
37         /// <summary>
38         /// 课程名称
39         /// </summary>
40         [stringlength(150)]
41         public string name { get; set; }
42         /// <summary>
43         /// 课程积分
44         /// </summary>
45         [range(0, 5)]
46         public int credits { get; set; }
47         /// <summary>
48         /// 备注
49         /// </summary>
50         [stringlength(200)]
51         public string remarks { get; set; }
52         /// <summary>
53         /// 状态: 0 正常, 1 废弃
54         /// </summary>
55         public int? status { get; set; }
56         /// <summary>
57         /// 创建日期
58         /// </summary>
59         public datetime? createdate { get; set; }
60         /// <summary>
61         /// 创建人
62         /// </summary>
63         [stringlength(50)]
64         public string createname { get; set; }
65         /// <summary>
66         /// 修改日期
67         /// </summary>
68         public datetime? updatedate { get; set; }
69         /// <summary>
70         /// 修改人
71         /// </summary>
72         [stringlength(50)]
73         public string updatename { get; set; }
74 
75         public datetime creationtime { get; set; }
76     }
77 }