| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using WCS.Entity;namespace WCS.Core{    public abstract class EntityEx<T>    {         public T Entity        {            get; private set;        }        public EntityEx(T entity)        {            this.Entity = entity;        }        public virtual DateTime UpdateTime { get; set; }        public double Times        {            get            {                return (DateTime.Now - UpdateTime).TotalMilliseconds;            }        }         public override string ToString()        {            return Entity.ToString();        }    }     public class Device<T> : EntityEx<WCS_DEVICE> where T : IProtocol    {        public T Data { get; private set; }        public Device(WCS_DEVICE entity) : base(entity)        {            Data = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T).AssemblyQualifiedName).Single().Data<T>();        }      }    public class Device<T, T2> : Device<T> where T : IProtocol where T2 : IProtocol    {        public T2 Data2 { get; private set; }        public Device(WCS_DEVICE entity) : base(entity)        {            Data2 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T2).AssemblyQualifiedName).Single().Data<T2>();        }    }    public class Device<T, T2, T3> : Device<T,T2> where T : IProtocol where T2 : IProtocol where T3 : IProtocol    {        public T3 Data3 { get; private set; }        public Device(WCS_DEVICE entity) : base(entity)        {            Data3 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T3).AssemblyQualifiedName).Single().Data<T3>();        }    }    public class Device<T, T2, T3, T4> : Device<T, T2, T3> where T : IProtocol where T2 : IProtocol where T3 : IProtocol where T4 : IProtocol    {        public T4 Data4 { get; private set; }        public Device(WCS_DEVICE entity) : base(entity)        {            Data4 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T4).AssemblyQualifiedName).Single().Data<T4>();        }    }}
 |