| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using SqlSugar;
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- namespace WCS.Entity
- {
- [Serializable]
- public abstract class OBJ
- {
- [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "ID")]
- [Column(Order = 0)]
- [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
- [Display(Name = "主键", Order = 0)]
- [Key]
- public virtual int ID { get; set; }
- [SugarColumn(ColumnDescription = "是否可用")]
- [Display(Name = "可用")]
- public bool ENABLED { get; set; } = true;
- [SugarColumn(ColumnDescription = "是否可用", Length = 50, IsNullable = true)]
- [Display(Name = "更新者")]
- [MaxLength(50)]
- [Required]
- public string UPDATEUSER { get; set; }
- [SugarColumn(ColumnDescription = "更新时间")]
- [Display(Name = "更新时间")]
- public DateTime UPDATETIME { get; set; } = DateTime.Now;
- [SugarColumn(ColumnDescription = "更新时间")]
- [Timestamp]
- [Display(Name = "版本")]
- public byte[] VER { get; set; }
- public T Copy<T>() where T : OBJ
- {
- var instance = Activator.CreateInstance<T>();
- foreach (var property in GetType().GetProperties())
- {
- var obj = property.GetValue(this);
- typeof(T).GetProperty(property.Name)!.SetValue(instance, obj);
- }
- return instance;
- }
- }
- }
|