123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- namespace DataSimulation.Repostory
- {
- public abstract class BaseModel
- {
- public BaseModel()
- {
- this.CreateTime = DateTime.Now;
- this.UpdateTime = DateTime.Now;
- }
- [Key] // 主键
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // 自增列
- [Display(Name ="编号")]
- public int ID { get; set; }
- [Display(Name = "创建时间")]
- public DateTime CreateTime { get; set; }
- [Display(Name = "更新时间")]
- public DateTime UpdateTime { get; set; }
- }
- public abstract class BaseModel<TID>
- {
- public BaseModel()
- {
- this.CreateTime = DateTime.Now;
- this.UpdateTime = DateTime.Now;
- }
- [Display(Name = "编号")]
- public TID ID { get; set; }
- [Display(Name = "创建时间")]
- public DateTime CreateTime { get; set; }
- [Display(Name = "更新时间")]
- public DateTime UpdateTime { get; set; }
- }
- }
|