ABP Development Notes 6 - Creating the domain layer entity

Click here to enter the ABP Development Notes directory 

Creating entity

In the field layer (i.e. JD.CRS.Core) Entitys // create a new folder for storing the entity object
to add an entity class Course.cs // the class

 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          /// Note
 49          ///  </ Summary> 
50          [the StringLength ( 200 is )]
 51 is          public  String Remarks { GET ; SET ;}
 52 is          ///  <Summary> 
53 is          /// status: normal 0, 1 waste
 54 is          ///  </ Summary> 
55          public  int ? the status { GET ; SET ;}
 56 is          ///  <Summary> 
57 is          /// creation date
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 }
Class Course

Guess you like

Origin www.cnblogs.com/IT-Evan/p/ABP6.html