1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using Microsoft.EntityFrameworkCore;
- using System.ComponentModel.DataAnnotations;
- using System.Xml.Linq;
- namespace DW5S.Entity
- {
- [Index(nameof(UpdateTime))]
- public abstract class BaseEntity
- {
- public BaseEntity()
- {
- this.CreateTime = DateTime.Now;
- this.UpdateTime = DateTime.Now;
- }
- [Key]
- [Display(Name = "编号")]
- public int Id { get; set; }
- [Display(Name = "创建时间")]
- [DisplayFormat(DataFormatString = "yyyy-MM-dd HH:mm:ss")]
- public DateTime CreateTime { get; set; }
- [Display(Name = "更新时间")]
- [DisplayFormat(DataFormatString = "yyyy-MM-dd HH:mm:ss")]
- public DateTime UpdateTime { get; set; }
- }
- public abstract class BaseEntityLong : BaseEntity
- {
- public BaseEntityLong()
- {
- this.CreateTime = DateTime.Now;
- this.UpdateTime = DateTime.Now;
- }
- [Key]
- [Display(Name = "编号")]
- public new long Id { get; set; }
- }
- }
|