ABP入门教程6 - 领域层创建实体

posted @   智慧园区-老朱  阅读(2767)  评论(0编辑  收藏  举报

点这里进入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 }
View Code
复制代码

 

posted @   智慧园区-老朱  阅读(2767)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
点击右上角即可分享
微信分享提示