using Furion.DatabaseAccessor; using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; namespace Admin.NET.Core { /// /// 自定义实体基类 /// public abstract class DEntityBase : DEntityBase { public DEntityBase() { Id = Yitter.IdGenerator.YitIdHelper.NextId(); } } public abstract class DEntityBase : PrivateDEntityBase where TDbContextLocator1 : class, IDbContextLocator { } public abstract class PrivateDEntityBase : IPrivateEntity { /// /// 主键Id /// [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] [Comment("Id主键")] public virtual TKey Id { get; set; } /// /// 创建时间 /// [Comment("创建时间")] public virtual DateTimeOffset? CreatedTime { get; set; } = DateTime.Now; /// /// 更新时间 /// [Comment("更新时间")] public virtual DateTimeOffset? UpdatedTime { get; set; } = DateTime.Now; /// /// 创建者Id /// [Comment("创建者Id")] public virtual long? CreatedUserId { get; set; } /// /// 创建者名称 /// [Comment("创建者名称")] [MaxLength(50)] public virtual string CreatedUserName { get; set; } /// /// 修改者Id /// [Comment("修改者Id")] public virtual long? UpdatedUserId { get; set; } /// /// 修改者名称 /// [Comment("修改者名称")] [MaxLength(50)] public virtual string UpdatedUserName { get; set; } /// /// 软删除 /// [JsonIgnore] [Comment("软删除标记")] public virtual bool IsDeleted { get; set; } = false; } }