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