using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareLog.ORM; using System; using System.Collections.Generic; namespace iWareLog.LOG.Entity { public class ReceiveMsgLogEntity : ICommonEntity { /// /// 接受信息日志主键 /// public int Id { get; set; } /// /// 接受类型,0为wip,1为rcs, 2为人工发送 /// public int Type { get; set; } /// /// 调用接口名称 /// public string InterfaceName { get; set; } /// /// 请求字符串 /// public string RequestStr { get; set; } /// /// 应答字符串 /// public string ResponseStr { get; set; } /// /// 请求时间 /// public DateTime ReceiveTime { get; set; } /// /// 备注 /// public string Remark { get; set; } /// /// 构造函数 /// public ReceiveMsgLogEntity() { } /// /// 构造函数 /// /// orm中的模型 public ReceiveMsgLogEntity(LOGReceiveMsgLog receive) { EntityPropHelper.CopyProp(receive, this, GetColumnMap()); } /// /// 获取自定义类ReceiveMsgLogEntity的字段名为键,ORM对象中字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { {"Id", "id"}, {"Type", "type"}, {"InterfaceName", "interfacename"}, {"RequestStr", "requeststr"}, {"ResponseStr", "responsestr"}, {"ReceiveTime","receivetime"}, {"Remark","remark"} }; } /// /// 将ReceiveMsgLogEntity实体转化为orm里面的LOGReceiveMsgLog模型 /// /// orm中的LOGReceiveMsgLog模型 public LOGReceiveMsgLog ToOrm() { var receive = new LOGReceiveMsgLog(); EntityPropHelper.CopyProp(this, receive, GetColumnMap()); return receive; } /// /// 根据ReceiveMsgLogEntity的字段转LOGReceiveMsgLog的字段 /// /// ReceiveMsgLogEntity的字段 /// LOGReceiveMsgLog public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取ReceiveMsgLogEntity对应的表名 /// /// LOGReceiveMsgLog public static string GetTableName() { return "[dbo].[LOGReceiveMsgLog]"; } } }