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

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

创建实体

在领域层(即JD.CRS.Core)下新建文件夹Entitys //用以存放实体对象
添加一个实体类Course.cs //课程信息

 using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using Abp.Timing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; namespace JD.CRS.Entitys
{
public class Course : Entity<int>, IHasCreationTime
{
public Course()
{
this.Code = string.Empty;
this.DepartmentCode = string.Empty;
this.Name = string.Empty;
this.Credits = ;
this.Remarks = string.Empty;
this.Status = ;
this.CreateDate = null;
this.CreateName = string.Empty;
this.UpdateDate = null;
this.UpdateName = string.Empty;
this.CreationTime = Clock.Now;
}
/// <summary>
/// 课程编号
/// </summary>
[StringLength()]
public string Code { get; set; }
/// <summary>
/// 院系编号
/// </summary>
[StringLength()]
public string DepartmentCode { get; set; }
/// <summary>
/// 课程名称
/// </summary>
[StringLength()]
public string Name { get; set; }
/// <summary>
/// 课程积分
/// </summary>
[Range(, )]
public int Credits { get; set; }
/// <summary>
/// 备注
/// </summary>
[StringLength()]
public string Remarks { get; set; }
/// <summary>
/// 状态: 0 正常, 1 废弃
/// </summary>
public int? Status { get; set; }
/// <summary>
/// 创建日期
/// </summary>
public DateTime? CreateDate { get; set; }
/// <summary>
/// 创建人
/// </summary>
[StringLength()]
public string CreateName { get; set; }
/// <summary>
/// 修改日期
/// </summary>
public DateTime? UpdateDate { get; set; }
/// <summary>
/// 修改人
/// </summary>
[StringLength()]
public string UpdateName { get; set; } public DateTime CreationTime { get; set; }
}
}
上一篇:SLAM入门之视觉里程计(6):相机标定 张正友经典标定法详解


下一篇:ABP入门系列(18)—— 使用领域服务