using Chloe.Annotations; using Chloe.Entity; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DB { public abstract class SystemEntityTypeBuilder : EntityTypeBuilder where T : BaseChimsDb { protected SystemEntityTypeBuilder(string tableName) { this.MapTo(tableName); this.Property(a => a.ID).IsAutoIncrement(false).IsPrimaryKey(); this.UpdateIgnore(x => x.CreateUserId); this.UpdateIgnore(x => x.CreateDate); this.UpdateIgnore(x => x.CreateUserName); HasQueryFilter(x => x.IsDelete == 0 && x.IsEnable == 1); } } public class BaseChimsDb { [Column(IsPrimaryKey = true)] [NonAutoIncrement] public long ID { get; set; } /// /// public int IsEnable { get; set; } = 1; /// /// public int IsDelete { get; set; } = 0; /// /// [UpdateIgnore] public DateTime CreateDate { get; set; } = DateTime.Now; /// /// [UpdateIgnore] public string CreateUserId { get; set; } = ""; /// /// [UpdateIgnore] public string CreateUserName { get; set; } = ""; /// /// public DateTime LastModifyDate { get; set; } = DateTime.Now; /// /// public string LastModifyUserId { get; set; } = ""; /// /// public string LastModifyUserName { get; set; } = ""; public int SortCode { get; set; } = 0; } }