using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.Xml.Linq; namespace DW5S.Entity { /// /// int主键的Entity基类 /// [Index(nameof(UpdateTime))] public abstract class BaseEntity { /// /// /// public BaseEntity() { this.CreateTime = DateTime.Now; this.UpdateTime = DateTime.Now; } /// /// 编号 /// [Key] public int Id { get; set; } /// /// 创建时间 /// public DateTime CreateTime { get; set; } /// /// 更新时间 /// public DateTime UpdateTime { get; set; } } /// /// long类型主键的Entity基类 /// public abstract class BaseEntityLong : BaseEntity { /// /// /// public BaseEntityLong() { this.CreateTime = DateTime.Now; this.UpdateTime = DateTime.Now; } /// /// 编号 /// [Key] public new long Id { get; set; } } }